hecrj/wgpu_glyph

Support for depth testing?

paulkernfeld opened this issue · 3 comments

In certain cases, it might be nice to be able to render text that is behind objects that have already been rendered, i.e. by using depth testing.

I'm not 100% clear on how wgpu_glyph's rendering pipeline should interact with the user's rendering pipeline, but I think it might be possible to have the user pass in a DepthStencilStateDescriptor and a RenderPassDepthStencilAttachmentDescriptor.

hecrj commented

Absolutely. This feature is missing.

The challenge here is to offer a safe API. The issue is that if we create a pipeline with a DepthStencilStateDescriptor, then it should be mandatory for the user to provide a depth attachment to draw_queued.

I think we can easily achieve this with a phantom type D in GlyphBrush. Let me give it a shot.

hecrj commented

I have been able to get a draft implementation with a depth example in #13! I still have to think about some changes a bit, but let me know what you think!

Overall this does exactly what I was hoping for; thanks so much!