-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overlay to show discarded fragments #2775
Comments
I imagine the main difficulty in implementing this (compared to the other overlays) is that it would require somehow patching the shader to insert an extra buffer/image write just before each discard statement. |
This should be implementable without any shader patching on any API. The draw can be run to an off-screen target to generate a pass/fail stencil mask (unconditional stencil pass means passing fragments would write and any discarded fragments wouldn't) which can be tested against to render the overlay. I would not implement it as a heatmap, it would function the same as all the other 'test' overlays showing a pass or a fail - the overlays are intended for quick debugging & sanity checking, not detailed introspection. |
Yeah, the heatmap is not strictly necessary for my request. It would just be a consequence of how I thought it would be implemented. Your idea sounds good ❤️ |
While looking for something complete unrelated I did stumble upon this obscure website, describing http://zaynar.co.uk/docs/gl-intel-performance-queries.html Not sure if its of any help or worth to be implemented to enable that kind of thing at least on intel gpus. |
Intel HW perf counters are already supported #2034. |
Description
The ability to see how many fragments were discarded per pixel in a draw or pass can be useful to debug the execution of shaders containing discard statements (or in the case of HLSL, calls to
clip
). For example, it can be used to ensure that stochastic alpha masked/cutout geometry is being rendered correctly. It can also help debug fullscreen passes that are intended to execute only for certain pixels on the screen (e.g., the shading pass in a deferred renderer, a screen-space reflections shader, or a subsurface scattering shader). This could also be used to debug instances where nothing is rendering because too many fragments are being discarded.In my specific case, this feature would help debug a renderer which rasterizes proxy geometry (as a sort of acceleration structure), then traces a ray per pixel inside the volume, starting at the volume's surface. The rays discard in the event that they hit no geometry inside the volume.
As far as I can tell, none of the current overlays are affected by discarding, so they don't help with the aforementioned situations. I also could not find any
Without this feature, it is still possible, but rather cumbersome to debug discarded fragments by replacing them with a bright color. However, this fails for debugging cases with overlapping geometry.
The overlay would create a heatmap of discarded fragments (each discarded fragment adds to the heat at that pixel), much in the style of the quad overdraw overlay. There could be an option to view the heatmap for just the draw or the entire pass, as the user desires.
Environment
The text was updated successfully, but these errors were encountered: