Page MenuHome

Object Rendered incorrectly in Vertex Select Edit Mode
Open, NormalPublic

Description

In edit mode when selecting vertices, the object is drawn incorrectly (see GIF). Each triangle is drawn with a cyan to black gradient with an additive black to red gradient that seems to represent depth. It goes away when you rotate the object or switch to Edge or Face Select.

Details

Type
Bug

Event Timeline

Sebastian Parborg (zeddb) triaged this task as Normal priority.Fri, Dec 7, 3:47 PM

Is this still a problem in newer blender betas?
If it still is, provide the output if you run blender with --debug-gpu and check also if --debug-gpu-force-workarounds solves anything

Nolans-MacBook-Pro% ./blender28.app/Contents/MacOS/blender --debug-gpu
Read prefs: /Users/nbaker/Library/Application Support/Blender/2.80/config/userpref.blend
OpenGL debug callback is not available on Apple.
found bundled python: /Applications/blender28/blender28.app/Contents/Resources/2.80/python
Traceback (most recent call last):
  File "/Applications/blender28/blender28.app/Contents/Resources/2.80/scripts/modules/addon_utils.py", line 377, in enable
    raise Exception(f"Add-on '{module_name:s}' has not been upgraded to 2.8, ignoring")
Exception: Add-on 'io_scene_gltf2' has not been upgraded to 2.8, ignoring
GPUShader: linking error:
ERROR: Too many geometry shader invocations

GPUShader: linking error:
ERROR: Too many geometry shader invocations

GPUShader: linking error:
ERROR: Too many geometry shader invocations

GPUShader: linking error:
ERROR: Too many geometry shader invocations

GPUShader: linking error:
ERROR: Too many geometry shader invocations

GPUShader: linking error:
ERROR: Too many geometry shader invocations

GPUShader: linking error:
ERROR: Too many geometry shader invocations

GPUShader: linking error:
ERROR: Too many geometry shader invocations

GPUShader: linking error:
ERROR: Too many geometry shader invocations

GPUShader: linking error:
ERROR: Too many geometry shader invocations

GPUShader: linking error:
ERROR: Too many geometry shader invocations

GPUShader: linking error:
ERROR: Too many geometry shader invocations

Warning: Pass : ?, Uniform 'viewportSize' not found!
Warning: Pass : ?, Uniform 'edgeScale' not found!
Warning: Pass : ?, Uniform 'viewportSize' not found!
Warning: Pass : ?, Uniform 'edgeScale' not found!
Warning: Pass : ?, Uniform 'dataBuffer' not found!
Warning: Pass : ?, Uniform 'viewportSize' not found!
Warning: Pass : ?, Uniform 'edgeScale' not found!
Warning: Pass : ?, Uniform 'viewportSize' not found!
Warning: Pass : ?, Uniform 'edgeScale' not found!
Warning: Pass : ?, Uniform 'dataBuffer' not found!
Warning: Pass : ?, Uniform 'viewportSize' not found!
Warning: Pass : ?, Uniform 'edgeScale' not found!
Warning: Pass : ?, Uniform 'viewportSize' not found!
Warning: Pass : ?, Uniform 'edgeScale' not found!
Warning: Pass : ?, Uniform 'dataBuffer' not found!
Warning: Pass : ?, Uniform 'viewportSize' not found!
Warning: Pass : ?, Uniform 'edgeScale' not found!
Warning: Pass : ?, Uniform 'viewportSize' not found!
Warning: Pass : ?, Uniform 'edgeScale' not found!
Warning: Pass : ?, Uniform 'dataBuffer' not found!
Warning: Pass : ?, Uniform 'viewportSize' not found!
Warning: Pass : ?, Uniform 'edgeScale' not found!
Warning: Pass : ?, Uniform 'viewportSize' not found!
Warning: Pass : ?, Uniform 'edgeScale' not found!
Warning: Pass : ?, Uniform 'dataBuffer' not found!
Warning: Pass : ?, Uniform 'viewportSize' not found!
Warning: Pass : ?, Uniform 'edgeScale' not found!
Warning: Pass : ?, Uniform 'viewportSize' not found!
Warning: Pass : ?, Uniform 'edgeScale' not found!
Warning: Pass : ?, Uniform 'dataBuffer' not found!
Warning: Pass : ?, Uniform 'viewportSize' not found!
Warning: Pass : ?, Uniform 'edgeScale' not found!
Warning: Pass : ?, Uniform 'viewportSize' not found!
Warning: Pass : ?, Uniform 'edgeScale' not found!
Warning: Pass : ?, Uniform 'dataBuffer' not found!
Warning: Pass : ?, Uniform 'viewportSize' not found!
Warning: Pass : ?, Uniform 'edgeScale' not found!
Warning: Pass : ?, Uniform 'viewportSize' not found!
Warning: Pass : ?, Uniform 'edgeScale' not found!
Warning: Pass : ?, Uniform 'dataBuffer' not found!
Warning: Pass : ?, Uniform 'viewportSize' not found!
Warning: Pass : ?, Uniform 'edgeScale' not found!
Warning: Pass : ?, Uniform 'viewportSize' not found!
Warning: Pass : ?, Uniform 'edgeScale' not found!
Warning: Pass : ?, Uniform 'viewportSize' not found!
Nolans-MacBook-Pro% ./blender28.app/Contents/MacOS/blender --debug-gpu-force-workarounds                         
Read prefs: /Users/nbaker/Library/Application Support/Blender/2.80/config/userpref.blend
found bundled python: /Applications/blender28/blender28.app/Contents/Resources/2.80/python
Traceback (most recent call last):
  File "/Applications/blender28/blender28.app/Contents/Resources/2.80/scripts/modules/addon_utils.py", line 377, in enable
    raise Exception(f"Add-on '{module_name:s}' has not been upgraded to 2.8, ignoring")
Exception: Add-on 'io_scene_gltf2' has not been upgraded to 2.8, ignoring
unknown argument, loading as file: --debug-gpu-force-workarounds
Error: Cannot read file '/Applications/blender28/--debug-gpu-force-workarounds': No such file or directory
Error: argument has no '.blend' file extension, not using as new file, exiting! /Applications/blender28/--debug-gpu-force-workarounds
Saved session recovery to '/tmp/quit.blend'

Blender quit

Those outputs are with the December 4th build (blender-2.80.1b6a394d862-x86_64). Perhaps there's a newer build I'm unaware of, but that's the latest available at https://builder.blender.org/download/ . "--debug-gpu-force-workarounds" doesn't seem to work as an argument in that build.

Yep the build is too old for --debug-gpu-force-workarounds. But ERROR: Too many geometry shader invocations is concerning. Can you run using the option --debug so that I can see which shaders fail to compile?

Nolans-MacBook-Pro% ./blender --debug
Switching to fully guarded memory allocator.
Blender 2.80 (sub 35)
Build: 2018-12-04 01:09:28 Darwin Release
argv[0] = ./blender
argv[1] = --debug
read file /Users/nbaker/Library/Application Support/Blender/2.80/config/userpref.blend
  Version 280 sub 35 date 2018-11-29 22:54 hash 63c06531707
Read prefs: /Users/nbaker/Library/Application Support/Blender/2.80/config/userpref.blend
read file 
  Version 280 sub 24 date unknown hash unknown
found bundled python: /Applications/blender28/blender28.app/Contents/Resources/2.80/python
Traceback (most recent call last):
  File "/Applications/blender28/blender28.app/Contents/Resources/2.80/scripts/modules/addon_utils.py", line 377, in enable
    raise Exception(f"Add-on '{module_name:s}' has not been upgraded to 2.8, ignoring")
Exception: Add-on 'io_scene_gltf2' has not been upgraded to 2.8, ignoring
GPUShader: linking error:
===== shader string 1 ====
 1  #define INFINITE 1000.0
 2  
 3  uniform mat4 ModelViewProjectionMatrix;
 4  
 5  uniform vec3 lightDirection = vec3(0.57, 0.57, -0.57);
 6  uniform float lightDistance = 1e4;
 7  
 8  in vec3 pos;
 9  
10  out VertexData {
11  	vec3 pos;           /* local position */
12  	vec4 frontPosition; /* final ndc position */
13  	vec4 backPosition;
14  } vData;
15  
16  void main()
17  {
18  	vData.pos = pos;
19  	vData.frontPosition = ModelViewProjectionMatrix * vec4(pos, 1.0);
20  	vData.backPosition  = ModelViewProjectionMatrix * vec4(pos + lightDirection * lightDistance, 1.0);
21  }
ERROR: Too many geometry shader invocations

GPUShader: linking error:
===== shader string 1 ====
 1  #extension GL_ARB_gpu_shader5 : enable
 2  
 3  #ifdef GL_ARB_gpu_shader5
 4  #define USE_INVOC_EXT
 5  #endif
 6  
 7  #ifdef DOUBLE_MANIFOLD
 8  #  ifdef USE_INVOC_EXT
 9  #    define invoc_len 2
10  #  else
11  #    define vert_len 8
12  #  endif
13  #else
14  #  ifdef USE_INVOC_EXT
15  #    define invoc_len 1
16  #  else
17  #    define vert_len 4
18  #  endif
19  #endif
20  
21  #ifdef USE_INVOC_EXT
22  layout(lines_adjacency, invocations = invoc_len) in;
23  layout(triangle_strip, max_vertices = 4) out;
24  #else
25  layout(lines_adjacency) in;
26  layout(triangle_strip, max_vertices = vert_len) out;
27  #endif
28  
29  uniform vec3 lightDirection = vec3(0.57, 0.57, -0.57);
30  
31  in VertexData {
32  	vec3 pos;           /* local position */
33  	vec4 frontPosition; /* final ndc position */
34  	vec4 backPosition;
35  } vData[];
36  
37  #define DEGENERATE_THRESHOLD 1e-12
38  
39  #define len_sqr(a) dot(a, a)
40  
41  void extrude_edge(bool invert)
42  {
43  	/* Reverse order if backfacing the light. */
44  	ivec2 idx = (invert) ? ivec2(1, 2) : ivec2(2, 1);
45  	gl_Position = vData[idx.x].frontPosition; EmitVertex();
46  	gl_Position = vData[idx.y].frontPosition; EmitVertex();
47  	gl_Position = vData[idx.x].backPosition; EmitVertex();
48  	gl_Position = vData[idx.y].backPosition; EmitVertex();
49  	EndPrimitive();
50  }
51  
52  void main()
53  {
54  	vec3 v10 = vData[0].pos - vData[1].pos;
55  	vec3 v12 = vData[2].pos - vData[1].pos;
56  	vec3 v13 = vData[3].pos - vData[1].pos;
57  
58  #ifdef DEGENERATE_THRESHOLD
59  	vec3 v20 = vData[0].pos - vData[2].pos;
60  	vec3 v23 = vData[3].pos - vData[2].pos;
61  
62  	vec4 edges_lensqr = vec4(len_sqr(v10), len_sqr(v13), len_sqr(v20), len_sqr(v23));
63  	bvec4 degen_edges = lessThan(edges_lensqr, vec4(DEGENERATE_THRESHOLD));
64  
65  	/* Both triangles are degenerate, abort. */
66  	if (any(degen_edges.xz) && any(degen_edges.yw))
67  		return;
68  #endif
69  
70  	vec3 n1 = cross(v12, v10);
71  	vec3 n2 = cross(v13, v12);
72  	vec2 facing = vec2(dot(n1, lightDirection),
73  	                   dot(n2, lightDirection));
74  
75  	/* WATCH: maybe unpredictable in some cases. */
76  	bool is_manifold = any(notEqual(vData[0].pos, vData[3].pos));
77  
78  	bvec2 backface = greaterThan(facing, vec2(0.0));
79  
80  #ifdef DEGENERATE_THRESHOLD
81  #  ifndef DOUBLE_MANIFOLD
82  	/* If the mesh is known to be manifold and we don't use double count,
83  	 * only create an quad if the we encounter a facing geom. */
84  	if ((any(degen_edges.xz) && backface.y) ||
85  		(any(degen_edges.yw) && backface.x))
86  		return;
87  #  endif
88  
89  	/* If one of the 2 triangles is degenerate, replace edge by a non-manifold one. */
90  	backface.x = (any(degen_edges.xz)) ? !backface.y : backface.x;
91  	backface.y = (any(degen_edges.yw)) ? !backface.x : backface.y;
92  	is_manifold = (any(degen_edges)) ? false : is_manifold;
93  #endif
94  
95  	/* If both faces face the same direction it's not an outline edge. */
96  	if (backface.x == backface.y)
97  		return;
98  
99  #ifdef USE_INVOC_EXT
100  	if (gl_InvocationID == 0) {
101  		extrude_edge(backface.x);
102  	}
103  	else if (is_manifold) {
104  #  ifdef DOUBLE_MANIFOLD
105  		/* Increment/Decrement twice for manifold edges. */
106  		extrude_edge(backface.x);
107  #  endif
108  	}
109  #else
110  	extrude_edge(backface.x);
111  	if (is_manifold) {
112  #  ifdef DOUBLE_MANIFOLD
113  		/* Increment/Decrement twice for manifold edges. */
114  		extrude_edge(backface.x);
115  #  endif
116  	}
117  #endif
118  }
ERROR: Too many geometry shader invocations

GPUShader: linking error:
===== shader string 1 ====
 1  
 2  void main()
 3  {
 4  	// no color output, only depth (line below is implicit)
 5  	// gl_FragDepth = gl_FragCoord.z;
 6  }
ERROR: Too many geometry shader invocations

GPUShader: linking error:
===== shader string 1 ====
 1  #define INFINITE 1000.0
 2  
 3  uniform mat4 ModelViewProjectionMatrix;
 4  
 5  uniform vec3 lightDirection = vec3(0.57, 0.57, -0.57);
 6  uniform float lightDistance = 1e4;
 7  
 8  in vec3 pos;
 9  
10  out VertexData {
11  	vec3 pos;           /* local position */
12  	vec4 frontPosition; /* final ndc position */
13  	vec4 backPosition;
14  } vData;
15  
16  void main()
17  {
18  	vData.pos = pos;
19  	vData.frontPosition = ModelViewProjectionMatrix * vec4(pos, 1.0);
20  	vData.backPosition  = ModelViewProjectionMatrix * vec4(pos + lightDirection * lightDistance, 1.0);
21  }
ERROR: Too many geometry shader invocations

GPUShader: linking error:
===== shader string 1 ====
 1  #extension GL_ARB_gpu_shader5 : enable
 2  
 3  #ifdef GL_ARB_gpu_shader5
 4  #define USE_INVOC_EXT
 5  #endif
 6  
 7  #ifdef DOUBLE_MANIFOLD
 8  #  ifdef USE_INVOC_EXT
 9  #    define invoc_len 2
10  #  else
11  #    define vert_len 8
12  #  endif
13  #else
14  #  ifdef USE_INVOC_EXT
15  #    define invoc_len 1
16  #  else
17  #    define vert_len 4
18  #  endif
19  #endif
20  
21  #ifdef USE_INVOC_EXT
22  layout(lines_adjacency, invocations = invoc_len) in;
23  layout(triangle_strip, max_vertices = 4) out;
24  #else
25  layout(lines_adjacency) in;
26  layout(triangle_strip, max_vertices = vert_len) out;
27  #endif
28  
29  uniform vec3 lightDirection = vec3(0.57, 0.57, -0.57);
30  
31  in VertexData {
32  	vec3 pos;           /* local position */
33  	vec4 frontPosition; /* final ndc position */
34  	vec4 backPosition;
35  } vData[];
36  
37  #define DEGENERATE_THRESHOLD 1e-12
38  
39  #define len_sqr(a) dot(a, a)
40  
41  void extrude_edge(bool invert)
42  {
43  	/* Reverse order if backfacing the light. */
44  	ivec2 idx = (invert) ? ivec2(1, 2) : ivec2(2, 1);
45  	gl_Position = vData[idx.x].frontPosition; EmitVertex();
46  	gl_Position = vData[idx.y].frontPosition; EmitVertex();
47  	gl_Position = vData[idx.x].backPosition; EmitVertex();
48  	gl_Position = vData[idx.y].backPosition; EmitVertex();
49  	EndPrimitive();
50  }
51  
52  void main()
53  {
54  	vec3 v10 = vData[0].pos - vData[1].pos;
55  	vec3 v12 = vData[2].pos - vData[1].pos;
56  	vec3 v13 = vData[3].pos - vData[1].pos;
57  
58  #ifdef DEGENERATE_THRESHOLD
59  	vec3 v20 = vData[0].pos - vData[2].pos;
60  	vec3 v23 = vData[3].pos - vData[2].pos;
61  
62  	vec4 edges_lensqr = vec4(len_sqr(v10), len_sqr(v13), len_sqr(v20), len_sqr(v23));
63  	bvec4 degen_edges = lessThan(edges_lensqr, vec4(DEGENERATE_THRESHOLD));
64  
65  	/* Both triangles are degenerate, abort. */
66  	if (any(degen_edges.xz) && any(degen_edges.yw))
67  		return;
68  #endif
69  
70  	vec3 n1 = cross(v12, v10);
71  	vec3 n2 = cross(v13, v12);
72  	vec2 facing = vec2(dot(n1, lightDirection),
73  	                   dot(n2, lightDirection));
74  
75  	/* WATCH: maybe unpredictable in some cases. */
76  	bool is_manifold = any(notEqual(vData[0].pos, vData[3].pos));
77  
78  	bvec2 backface = greaterThan(facing, vec2(0.0));
79  
80  #ifdef DEGENERATE_THRESHOLD
81  #  ifndef DOUBLE_MANIFOLD
82  	/* If the mesh is known to be manifold and we don't use double count,
83  	 * only create an quad if the we encounter a facing geom. */
84  	if ((any(degen_edges.xz) && backface.y) ||
85  		(any(degen_edges.yw) && backface.x))
86  		return;
87  #  endif
88  
89  	/* If one of the 2 triangles is degenerate, replace edge by a non-manifold one. */
90  	backface.x = (any(degen_edges.xz)) ? !backface.y : backface.x;
91  	backface.y = (any(degen_edges.yw)) ? !backface.x : backface.y;
92  	is_manifold = (any(degen_edges)) ? false : is_manifold;
93  #endif
94  
95  	/* If both faces face the same direction it's not an outline edge. */
96  	if (backface.x == backface.y)
97  		return;
98  
99  #ifdef USE_INVOC_EXT
100  	if (gl_InvocationID == 0) {
101  		extrude_edge(backface.x);
102  	}
103  	else if (is_manifold) {
104  #  ifdef DOUBLE_MANIFOLD
105  		/* Increment/Decrement twice for manifold edges. */
106  		extrude_edge(backface.x);
107  #  endif
108  	}
109  #else
110  	extrude_edge(backface.x);
111  	if (is_manifold) {
112  #  ifdef DOUBLE_MANIFOLD
113  		/* Increment/Decrement twice for manifold edges. */
114  		extrude_edge(backface.x);
115  #  endif
116  	}
117  #endif
118  }
ERROR: Too many geometry shader invocations

GPUShader: linking error:
===== shader string 1 ====
 1  
 2  void main()
 3  {
 4  	// no color output, only depth (line below is implicit)
 5  	// gl_FragDepth = gl_FragCoord.z;
 6  }
ERROR: Too many geometry shader invocations

GPUShader: linking error:
===== shader string 1 ====
 1  #define INFINITE 1000.0
 2  
 3  uniform mat4 ModelViewProjectionMatrix;
 4  
 5  uniform vec3 lightDirection = vec3(0.57, 0.57, -0.57);
 6  uniform float lightDistance = 1e4;
 7  
 8  in vec3 pos;
 9  
10  out VertexData {
11  	vec3 pos;           /* local position */
12  	vec4 frontPosition; /* final ndc position */
13  	vec4 backPosition;
14  } vData;
15  
16  void main()
17  {
18  	vData.pos = pos;
19  	vData.frontPosition = ModelViewProjectionMatrix * vec4(pos, 1.0);
20  	vData.backPosition  = ModelViewProjectionMatrix * vec4(pos + lightDirection * lightDistance, 1.0);
21  }
ERROR: Too many geometry shader invocations

GPUShader: linking error:
===== shader string 1 ====
 1  #extension GL_ARB_gpu_shader5 : enable
 2  
 3  #ifdef GL_ARB_gpu_shader5
 4  #define USE_INVOC_EXT
 5  #endif
 6  
 7  #ifdef DOUBLE_MANIFOLD
 8  #  ifdef USE_INVOC_EXT
 9  #    define invoc_len 2
10  #  else
11  #    define vert_len 6
12  #  endif
13  #else
14  #  ifdef USE_INVOC_EXT
15  #    define invoc_len 2
16  #  else
17  #    define vert_len 6
18  #  endif
19  #endif
20  
21  #ifdef USE_INVOC_EXT
22  layout(triangles, invocations = invoc_len) in;
23  layout(triangle_strip, max_vertices = 3) out;
24  #else
25  layout(triangles) in;
26  layout(triangle_strip, max_vertices = vert_len) out;
27  #endif
28  
29  uniform vec3 lightDirection = vec3(0.57, 0.57, -0.57);
30  
31  in VertexData {
32  	vec3 pos;           /* local position */
33  	vec4 frontPosition; /* final ndc position */
34  	vec4 backPosition;
35  } vData[];
36  
37  vec4 get_pos(int v, bool backface)
38  {
39  	return (backface) ? vData[v].backPosition : vData[v].frontPosition;
40  }
41  
42  void emit_cap(const bool front, bool reversed)
43  {
44  	if (front) {
45  		gl_Position = vData[0].frontPosition; EmitVertex();
46  		gl_Position = vData[reversed ? 2 : 1].frontPosition; EmitVertex();
47  		gl_Position = vData[reversed ? 1 : 2].frontPosition; EmitVertex();
48  	}
49  	else {
50  		gl_Position = vData[0].backPosition; EmitVertex();
51  		gl_Position = vData[reversed ? 1 : 2].backPosition; EmitVertex();
52  		gl_Position = vData[reversed ? 2 : 1].backPosition; EmitVertex();
53  	}
54  	EndPrimitive();
55  }
56  
57  void main()
58  {
59  	vec3 v10 = vData[0].pos - vData[1].pos;
60  	vec3 v12 = vData[2].pos - vData[1].pos;
61  
62  	vec3 n = cross(v12, v10);
63  	float facing = dot(n, lightDirection);
64  
65  	bool backface = facing > 0.0;
66  
67  #ifdef DOUBLE_MANIFOLD
68  	/* In case of non manifold geom, we only increase/decrease
69  	 * the stencil buffer by one but do every faces as they were facing the light. */
70  	bool invert = backface;
71  #else
72  	const bool invert = false;
73  	if (!backface) {
74  #endif
75  #ifdef USE_INVOC_EXT
76  		bool do_front = (gl_InvocationID & 1) == 0;
77  		emit_cap(do_front, invert);
78  #else
79  		emit_cap(true, invert);
80  		emit_cap(false, invert);
81  #endif
82  #ifndef DOUBLE_MANIFOLD
83  	}
84  #endif
85  }
ERROR: Too many geometry shader invocations

GPUShader: linking error:
===== shader string 1 ====
 1  
 2  void main()
 3  {
 4  	// no color output, only depth (line below is implicit)
 5  	// gl_FragDepth = gl_FragCoord.z;
 6  }
ERROR: Too many geometry shader invocations

GPUShader: linking error:
===== shader string 1 ====
 1  #define INFINITE 1000.0
 2  
 3  uniform mat4 ModelViewProjectionMatrix;
 4  
 5  uniform vec3 lightDirection = vec3(0.57, 0.57, -0.57);
 6  uniform float lightDistance = 1e4;
 7  
 8  in vec3 pos;
 9  
10  out VertexData {
11  	vec3 pos;           /* local position */
12  	vec4 frontPosition; /* final ndc position */
13  	vec4 backPosition;
14  } vData;
15  
16  void main()
17  {
18  	vData.pos = pos;
19  	vData.frontPosition = ModelViewProjectionMatrix * vec4(pos, 1.0);
20  	vData.backPosition  = ModelViewProjectionMatrix * vec4(pos + lightDirection * lightDistance, 1.0);
21  }
ERROR: Too many geometry shader invocations

GPUShader: linking error:
===== shader string 1 ====
 1  #extension GL_ARB_gpu_shader5 : enable
 2  
 3  #ifdef GL_ARB_gpu_shader5
 4  #define USE_INVOC_EXT
 5  #endif
 6  
 7  #ifdef DOUBLE_MANIFOLD
 8  #  ifdef USE_INVOC_EXT
 9  #    define invoc_len 2
10  #  else
11  #    define vert_len 6
12  #  endif
13  #else
14  #  ifdef USE_INVOC_EXT
15  #    define invoc_len 2
16  #  else
17  #    define vert_len 6
18  #  endif
19  #endif
20  
21  #ifdef USE_INVOC_EXT
22  layout(triangles, invocations = invoc_len) in;
23  layout(triangle_strip, max_vertices = 3) out;
24  #else
25  layout(triangles) in;
26  layout(triangle_strip, max_vertices = vert_len) out;
27  #endif
28  
29  uniform vec3 lightDirection = vec3(0.57, 0.57, -0.57);
30  
31  in VertexData {
32  	vec3 pos;           /* local position */
33  	vec4 frontPosition; /* final ndc position */
34  	vec4 backPosition;
35  } vData[];
36  
37  vec4 get_pos(int v, bool backface)
38  {
39  	return (backface) ? vData[v].backPosition : vData[v].frontPosition;
40  }
41  
42  void emit_cap(const bool front, bool reversed)
43  {
44  	if (front) {
45  		gl_Position = vData[0].frontPosition; EmitVertex();
46  		gl_Position = vData[reversed ? 2 : 1].frontPosition; EmitVertex();
47  		gl_Position = vData[reversed ? 1 : 2].frontPosition; EmitVertex();
48  	}
49  	else {
50  		gl_Position = vData[0].backPosition; EmitVertex();
51  		gl_Position = vData[reversed ? 1 : 2].backPosition; EmitVertex();
52  		gl_Position = vData[reversed ? 2 : 1].backPosition; EmitVertex();
53  	}
54  	EndPrimitive();
55  }
56  
57  void main()
58  {
59  	vec3 v10 = vData[0].pos - vData[1].pos;
60  	vec3 v12 = vData[2].pos - vData[1].pos;
61  
62  	vec3 n = cross(v12, v10);
63  	float facing = dot(n, lightDirection);
64  
65  	bool backface = facing > 0.0;
66  
67  #ifdef DOUBLE_MANIFOLD
68  	/* In case of non manifold geom, we only increase/decrease
69  	 * the stencil buffer by one but do every faces as they were facing the light. */
70  	bool invert = backface;
71  #else
72  	const bool invert = false;
73  	if (!backface) {
74  #endif
75  #ifdef USE_INVOC_EXT
76  		bool do_front = (gl_InvocationID & 1) == 0;
77  		emit_cap(do_front, invert);
78  #else
79  		emit_cap(true, invert);
80  		emit_cap(false, invert);
81  #endif
82  #ifndef DOUBLE_MANIFOLD
83  	}
84  #endif
85  }
ERROR: Too many geometry shader invocations

GPUShader: linking error:
===== shader string 1 ====
 1  
 2  void main()
 3  {
 4  	// no color output, only depth (line below is implicit)
 5  	// gl_FragDepth = gl_FragCoord.z;
 6  }
ERROR: Too many geometry shader invocations

Building from source now. I'll report back when it's done.

Nolans-MacBook-Pro% ./blender --debug-gpu-force-workarounds
Read prefs: /Users/nbaker/Library/Application Support/Blender/2.80/config/userpref.blend

GPU: Bypassing workaround detection.
GPU: OpenGL indentification strings
GPU: vendor: Intel Inc.
GPU: renderer: Intel HD Graphics 3000 OpenGL Engine
GPU: version: 3.3 INTEL-10.4.14

found bundled python: /Users/nbaker/Projects/build_darwin/bin/blender.app/Contents/Resources/2.80/python
Traceback (most recent call last):
  File "/Users/nbaker/Projects/build_darwin/bin/blender.app/Contents/Resources/2.80/scripts/modules/addon_utils.py", line 377, in enable
    raise Exception(f"Add-on '{module_name:s}' has not been upgraded to 2.8, ignoring")
Exception: Add-on 'io_scene_gltf2' has not been upgraded to 2.8, ignoring
GPUShader: linking error:
ERROR: Too many geometry shader invocations

GPUShader: linking error:
ERROR: Too many geometry shader invocations

GPUShader: linking error:
ERROR: Too many geometry shader invocations

Still no dice even with "--debug-gpu-force-workarounds". Getting myself familiar with the codebase. I'll do my best to debug.

Ha! you are building from source! perfect. Can you test P866 and tell me if it fixes the error?

EDIT: Also prefer adding output log as attachement file instead of copy/pasting them.

Negative. Problem persists. The attached log shows all of the steps I took in applying the patch and building as well as the output from running it with the --debug flag turned on.

@ Nolan (QBertReynolds) Can you try commenting all ocurences of #define USE_INVOC_EXT?

All of the "ERROR: Too many geometry shader invocations" messages are gone though:

Nolans-MacBook-Pro% /Users/nbaker/Projects/build_darwin/bin/blender.app/Contents/MacOS/blender --debug
Switching to fully guarded memory allocator.
Blender 2.80 (sub 36)
Build: 2018-12-10 16:56:14 Darwin Release
argv[0] = /Users/nbaker/Projects/build_darwin/bin/blender.app/Contents/MacOS/blender
argv[1] = --debug
read file /Users/nbaker/Library/Application Support/Blender/2.80/config/userpref.blend
  Version 280 sub 35 date 2018-11-29 22:54 hash 63c06531707
Read prefs: /Users/nbaker/Library/Application Support/Blender/2.80/config/userpref.blend
read file 
  Version 280 sub 24 date unknown hash unknown
found bundled python: /Users/nbaker/Projects/build_darwin/bin/blender.app/Contents/Resources/2.80/python
Traceback (most recent call last):
  File "/Users/nbaker/Projects/build_darwin/bin/blender.app/Contents/Resources/2.80/scripts/modules/addon_utils.py", line 377, in enable
    raise Exception(f"Add-on '{module_name:s}' has not been upgraded to 2.8, ignoring")
Exception: Add-on 'io_scene_gltf2' has not been upgraded to 2.8, ignoring

Ok so the error message are gone !

Now for the actual issue: Can you try to apply P867?

Also did you try updating your driver?

My drivers are as up to date as they will ever be. Apple end-of-lifed my MacBook a few months ago since it's not Metal compatible card (Intel HD Graphics 3000 512 MB). All I get now are security patches.

Perhaps you could talk me through what you're thinking the issue might be. I've written my fair share of C and GLSL, so I'm sure I can be more useful once I'm somewhat familiar with this codebase.

I'm thinking it's an alignment problem. Or somehting unrelated in the shader (we had this issue with other drivers).

You may want to edit the 3 files edited by the patch.

But you did not tell me if the patch did anything.

My apologies. The patch has caused no change in behaviour.

You may also try to see what does the loose edges shader do.

Just extrude a vertex in edit mode and see if the edge is displayed correctly.

The actual shader that is buggy is combining:

  • edit_mesh_overlay_vert.glsl
  • edit_mesh_overlay_geom_tri.glsl
  • edit_mesh_overlay_frag.glsl

With the following defines:
VERTEX_FACING
VERTEX_SELECTION
EDGE_FIX

Woo! Making some form of progress:

Commenting out the line 199 - BLI_dynstr_append(ds, "#define VERTEX_FACING\n"); - in edit_mesh_mode.c makes it bearable to edit verts again.

Still poking around. I'll report back when I understand what's going on a little more.

I've narrowed it down to line 147 in edit_mesh_overlay_frag.glsl.

Commenting out the following seems to fix it:
FragColor.rgb = mix(colorEditMeshMiddle.rgb, FragColor.rgb, 1.0 - abs(facing) * 0.4);

From the looks of it, colorEditMeshMiddle is where the broken colors is coming from.

I think it's the use of the "facing" attribute. If you comment this line it gets optimized out.

Yep, you're right. When I change it to just FragColor.rgb = colorEditMeshMiddle.rgb;, it's just a darker grey color.

See if reordering attrib or adding padding to some of the vec3 (changing them to vec4) does fix this.


Sorry. I'm not a coder. But this appears to be part of the same problem.
In object mode / wireframe, we really suppose to see the triangles, as in the attached png?
Gets really complicated with more complex meshes...

thx again.
Pedro