mesa/src
Jason Ekstrand b447f5049b nir: Add a discard optimization pass
Many fragment shaders do a discard using relatively little information
but still put the discard fairly far down in the shader for no good
reason.  If the discard is moved higher up, we can possibly avoid doing
some or almost all of the work in the shader.  When this lets us skip
texturing operations, it's an especially high win.

One of the biggest offenders here is DXVK.  The D3D APIs have different
rules for discards than OpenGL and Vulkan.  One effective way (which is
what DXVK uses) to implement DX behavior on top of GL or Vulkan is to
wait until the very end of the shader to discard.  This ends up in the
pessimal case where we always do all of the work before discarding.
This pass helps some DXVK shaders significantly.

v2 (Jason Ekstrand):
 - Fix a couple of typos (Grazvydas, Ian)
 - Use the new nir_instr_move helper
 - Find all movable discards before moving anything so we don't
   accidentally re-order anything and break dependencies

v3 (Pierre-Eric): remove the call to nir_opt_conditional_discard based
on Daniel Schürmann comment.

v4 (Pierre-Eric):
 - handle demote intrinsics and drop derivatives_safe_after_discard
 - add early return if discards/demotes aren't used

v5 (Pierre-Eric):
 - use pass_flags instead of instr set (Daniel Schürmann)

v6 (Daniel Schürmann):
 - cleanup and fix pass_flags handling

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10522>
2021-05-19 18:04:44 +00:00
..
amd aco: disallow SGPRs on DPP instructions 2021-05-19 14:25:37 +00:00
android_stub android: add some more stub functions for cross compilation 2021-03-25 06:06:16 +00:00
asahi agx: Set reads_tib appropriately 2021-05-09 23:29:45 -04:00
broadcom ci/broadcom: update expected results 2021-05-18 15:52:57 +00:00
compiler nir: Add a discard optimization pass 2021-05-19 18:04:44 +00:00
drm-shim drm-shim: fix compile with glibc >= 2.33 2021-04-20 05:49:29 +00:00
egl dri: add loader_dri_create_image helper 2021-05-19 16:54:19 +00:00
etnaviv etnaviv: tell the truth if alpha-test is supported 2021-04-08 19:25:26 +00:00
freedreno turnip: make cmdstream bo's read-only to GPU 2021-05-17 18:29:09 +00:00
gallium gallium/dri: copy image use in dup_image 2021-05-19 16:54:19 +00:00
gbm dri: add loader_dri_create_image helper 2021-05-19 16:54:19 +00:00
getopt scons: Remove. 2021-03-20 10:38:55 +00:00
glx Revert "glx: s/Display */struct glx_display */ over internal API" 2021-05-03 15:00:41 -04:00
gtest
hgl hgl: Major refactor and cleanup 2021-01-09 20:51:35 -06:00
imgui
intel intel/vec4: Add support for UBO pushing 2021-05-19 14:38:13 +00:00
loader loader/dri: hook up createImageWithModifiers2 2021-05-19 16:54:19 +00:00
mapi mesa: fix incomplete GL_NV_half_float implementation 2021-04-26 03:35:21 +00:00
mesa i965: implement createImageWithModifiers2 2021-05-19 16:54:19 +00:00
microsoft microsoft/compiler: Maintain sorting of resource type in the context 2021-04-29 23:55:02 +00:00
nouveau nouveau: add drm-shim support 2021-01-11 22:45:01 +00:00
panfrost panfrost: Hoist part of shader_reads_tilebuffer 2021-05-18 22:51:56 +00:00
tool pps: Intel pps driver 2021-05-18 14:28:48 +00:00
util util: add thread-safe version of idalloc 2021-05-17 10:37:24 +00:00
virtio virgl: implement EXT_multisampled_render_to_texture 2021-05-18 18:54:16 +00:00
vulkan vulkan: Support 32-bit "weak" symbols on MSVC 2021-05-16 23:05:24 +00:00
meson.build freedreno: Add freedreno pps driver 2021-05-10 15:34:07 +00:00