Fix: GPU issue because of bound depth buffer

This fixes an issue reported when launching Blender with
`--debug-gpu`. The newly added "thick wires" feature for
bone shapes caused that problem.
The issue was that the shader definitions used
the depth tex as a sampler and at the same time wrote to it.

The fix is to remove the code that uses the depth texture.
This is just the simplest solution for now, and it doesn't change
the visual appearance of the bone shapes.

------

Note: the code I copied from was `overlay_edit_mesh_frag.glsl`.
So I assume the depth sampler is needed, but the pipeline
for bone shapes isn't set up to handle that.

Pull Request: https://projects.blender.org/blender/blender/pulls/122558
This commit is contained in:
Christoph Lendenfeld
2024-06-03 14:02:18 +02:00
committed by Clément Foucault
parent 6ec64cb039
commit 5069d41b18
2 changed files with 0 additions and 8 deletions

View File

@@ -151,7 +151,6 @@ GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_wire_geom_noperspective_iface,
GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire)
.do_static_compilation(true)
.push_constant(Type::BOOL, "do_smooth_wire")
.sampler(0, ImageType::DEPTH_2D, "depthTex")
.vertex_in(0, Type::VEC3, "pos")
/* Per instance. */
.vertex_in(2, Type::MAT4, "inst_obmat")
@@ -174,7 +173,6 @@ GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire_no_geom)
.metal_backend_only(true)
.do_static_compilation(true)
.push_constant(Type::BOOL, "do_smooth_wire")
.sampler(0, ImageType::DEPTH_2D, "depthTex")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(2, Type::MAT4, "inst_obmat")
.vertex_out(overlay_armature_shape_wire_geom_iface)

View File

@@ -19,11 +19,6 @@
#define GRID_LINE_SMOOTH_START (0.5 - DISC_RADIUS)
#define GRID_LINE_SMOOTH_END (0.5 + DISC_RADIUS)
bool test_occlusion()
{
return gl_FragCoord.z > texelFetch(depthTex, ivec2(gl_FragCoord.xy), 0).r;
}
float edge_step(float dist)
{
if (do_smooth_wire) {
@@ -48,7 +43,6 @@ void main()
fragColor = mix(vec4(geometry_out.finalColor.rgb, alpha), vec4(0), mix_w);
fragColor.a *= 1.0 - mix_w;
fragColor.a *= test_occlusion() ? alpha : 1.0;
select_id_output(select_id);
lineOutput = vec4(0);
}