Metal: EEVEE Next: Optimize Virtual shadow maps for Apple Silicon #111283

Merged
Clément Foucault merged 77 commits from Jason-Fielder/blender:eevee_next_metal_shadow_opti_tbdr into main 2023-10-05 19:02:47 +02:00

77 Commits

Author SHA1 Message Date
Clément Foucault 474285b96f Unset debug resultion
buildbot/vexp-code-patch-coordinator Build done. Details
2023-10-05 17:03:39 +02:00
Clément Foucault 2732dc05a8 Fix broken tests 2023-10-05 17:01:51 +02:00
Clément Foucault 498a1eed5e Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr
# Conflicts:
#	source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh
2023-10-05 16:34:48 +02:00
Clément Foucault dedee835d5 Fix shadow test 2023-10-05 16:21:08 +02:00
Clément Foucault 63921e0607 Fix gl subpass again 2023-10-05 16:20:58 +02:00
Clément Foucault 4fb0e20739 Revert to using another packing function for `src_coord_buf` 2023-10-05 16:20:10 +02:00
Clément Foucault 569371ce04 Final cleanup 2023-10-05 15:17:26 +02:00
Clément Foucault f994cb5b4a Change excessive check 2023-10-05 15:17:10 +02:00
Clément Foucault dac3075c74 Change tile indirect call to not be instance based for better debug ability 2023-10-05 15:16:53 +02:00
Clément Foucault 23cfcacf5f Fix shadow_page_pack functions and add asserts 2023-10-05 15:15:37 +02:00
Clément Foucault 6c989a8e07 Fix issue with subpass attachment not clearing 2023-10-05 15:14:53 +02:00
Clément Foucault 33a8248f84 Add subpass transition at the start of the shadow pass
and update documentation of subpasses
2023-10-05 15:14:35 +02:00
Clément Foucault 05492f4d66 Add more debugging defines 2023-10-05 15:13:31 +02:00
Clément Foucault b407681ce0 Last fixes 2023-10-01 18:11:21 +02:00
Clément Foucault 3a928c7254 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-10-01 18:02:27 +02:00
Clément Foucault 8786f83adb More cleanup and fixes 2023-10-01 17:16:58 +02:00
Clément Foucault 5657d94988 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-10-01 15:46:24 +02:00
Clément Foucault 964da14627 Cleanup and use depth buffer for atomic raster if present 2023-10-01 13:36:47 +02:00
Clément Foucault 6a8db18cd1 Cleanup and use indirect draw buffer with indirection buf 2023-10-01 02:10:02 +02:00
Clément Foucault 13b02a0b77 Make comments and codepath platform agnostic. 2023-09-30 22:03:44 +02:00
Clément Foucault 9df7c9dc87 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-09-30 21:38:41 +02:00
Michael Parkin-White f6230baca6 Remove formatting change for gpu_shader_Create_info 2023-09-29 20:49:24 +01:00
Michael Parkin-White 6c0348349a Further cleanup to remove redundant changes 2023-09-29 20:37:19 +01:00
Michael Parkin-White 4f73279050 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-09-29 20:00:38 +01:00
Michael Parkin-White ed180f0e2a Refactor TBDR clear and storage passes into subpasses of main shadow surface pass.
For now, shadow tile passes are invoked via an indirect call with the upper bound for tile updates, which are culled by the vertex stage.
2023-09-29 19:59:15 +01:00
Michael Parkin-White e3ce8115ed Remove fragment_tile_in as this was replaced with subpass_in. 2023-09-28 16:02:26 +01:00
Michael Parkin-White 30c724d615 Remove ifdef in shadow_page_clear_comp 2023-09-28 16:00:08 +01:00
Michael Parkin-White 4494dd0f85 Remove unrelated change 2023-09-28 15:59:00 +01:00
Michael Parkin-White 2270efd904 Remove framebuffer dirty flag for temporarily splitting passes.
Note this should be resolved at the high-level.
2023-09-28 15:58:41 +01:00
Michael Parkin-White f03154c74b Remove old FragTileIn definition 2023-09-28 15:58:03 +01:00
Michael Parkin-White d9b70b8ea9 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-09-28 15:57:17 +01:00
Michael Parkin-White 90f5e7a5e4 GPUArchitectureType change 2023-09-28 11:09:26 +01:00
Michael Parkin-White 37b9fe85a3 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-09-28 10:59:00 +01:00
Michael Parkin-White 4ab1809d56 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-09-26 20:25:21 +01:00
Michael Parkin-White 2f25bfde46 Remove shader debug name change as not relevant for this patch. 2023-09-26 20:13:45 +01:00
Michael Parkin-White b494127cf4 Remove template definitions for shadow atlas format as no longer required. 2023-09-26 19:58:12 +01:00
Michael Parkin-White 6530d9ea61 Address additional PR feedback and remove F32 atlas format switch for now 2023-09-26 19:54:59 +01:00
Michael Parkin-White 36ef965154 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-09-26 16:42:45 +01:00
Michael Parkin-White f260db24f1 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-09-26 14:50:24 +01:00
Michael Parkin-White a625fb3538 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-09-25 23:03:23 +01:00
Michael Parkin-White f896113d67 Guard atomic availability behind OS API support. 2023-09-25 17:43:49 +01:00
Michael Parkin-White 87bff15f5e Add texture usage flags for texture atomics. 2023-09-25 17:35:32 +01:00
Michael Parkin-White d7cc19a639 Undo erroneous platform change. 2023-09-25 17:31:34 +01:00
Michael Parkin-White 0b29f5e9c3 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-09-25 17:29:21 +01:00
Michael Parkin-White 2a0ad15dfe Add texture atomic support. 2023-09-25 17:28:00 +01:00
Michael Parkin-White 5191342ae5 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-09-20 18:25:58 +01:00
Michael Parkin-White e748f41afb Modify shadow technique selection based on GPU architecture 2023-09-19 11:36:31 +01:00
Michael Parkin-White 637b97440f GPU: Add platform parameter for GPU architecture
Authored by Apple: Michael Parkin-White
2023-09-19 11:12:33 +01:00
Michael Parkin-White c9d1642325 Resolve merge issues. 2023-09-18 13:56:21 +01:00
Michael Parkin-White c224dcb8ee Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-09-18 13:55:38 +01:00
Clément Foucault 2b3b86e7d4 Cleanup warning and some code duplication 2023-09-05 10:52:10 +02:00
Clément Foucault 1ff7d33fd2 Make format 2023-09-04 20:08:25 +02:00
Clément Foucault cf5e4ea9a8 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr
# Conflicts:
#	source/blender/draw/engines/eevee_next/shaders/eevee_shadow_tag_update_comp.glsl
#	source/blender/draw/engines/eevee_next/shaders/eevee_shadow_tilemap_bounds_comp.glsl
#	source/blender/draw/engines/eevee_next/shaders/eevee_surf_lib.glsl
#	source/blender/draw/engines/eevee_next/shaders/infos/eevee_material_info.hh
#	source/blender/gpu/GPU_texture.h
#	source/blender/gpu/intern/gpu_framebuffer.cc
#	source/blender/gpu/intern/gpu_shader_create_info.cc
#	source/blender/gpu/intern/gpu_shader_create_info.hh
#	source/blender/gpu/metal/mtl_framebuffer.mm
#	source/blender/gpu/shaders/metal/mtl_shader_defines.msl
#	source/blender/python/gpu/gpu_py_shader_create_info.cc
2023-09-04 20:05:48 +02:00
Michael Parkin-White e97f9a9072 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-08-31 15:32:38 +01:00
Michael Parkin-White 8ca4be5fea Lightprobe only needs a single use of BuiltinBits::LAYER 2023-08-31 15:32:16 +01:00
Michael Parkin-White 6a1446fc59 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-08-31 15:23:33 +01:00
Michael Parkin-White 9589be295a Move atlas format to a macro. This is the most reasonable way of allowing toggling while ensuring the eevee_shadow_data shader create info is valid for all uses. Also added a safety check to limit usage of the floating point atlas to Metal. 2023-08-31 15:23:10 +01:00
Michael Parkin-White 06a5111e58 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-08-31 10:48:20 +01:00
Michael Parkin-White 5f3c692b08 Enable the atomic pass to output results on macOS. This display is incorrect due to passthrough texture atomics, however, some form of shadow is visible and testable, and this can be used for the purpose of benchmarking 2023-08-31 10:46:07 +01:00
Michael Parkin-White dbe3d2b353 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-08-30 23:33:01 +01:00
Michael Parkin-White 773bdd9227 Further refactoring to separate out write modes for F32 vs U32 atlas for erroneous cases. Also addressing other small bits of feedback, including grid shift OOB/negative modulo issue.
Also add empty pasthrough for imageAtomicMin which performs a store-op to allow successful compilation of the shader
2023-08-30 23:25:26 +01:00
Michael Parkin-White 636af6fe1d further refinement of patch with decoupling of technique and atlas format usage.
Although it is not trivial to replace the atlas read routine texture binding depending on format, as the inclusion of the binding is nested fairly deeply.
2023-08-30 22:22:30 +01:00
Michael Parkin-White 7ef8a4d604 Switching shader material shader and other features depending on chosen shadow update technique. 2023-08-30 18:37:50 +01:00
Michael Parkin-White 748d55707a First-pass for refactor generalizing shadow update technique and removing Metal specific guards.
Still need to update guards inside shaders e.g. shadow surface shader and consider permutations
based on technique used instead. This is to ensure toggling the technique works as expected, rather than hitting different branches depending on system.
2023-08-30 13:15:26 +01:00
Michael Parkin-White 38241a3ae4 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-08-30 12:32:47 +01:00
Michael Parkin-White 3a09e1a4d9 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-08-29 13:45:24 +01:00
Michael Parkin-White 6598277ca0 Update decsriptions in shader 2023-08-29 12:07:06 +01:00
Michael Parkin-White a398fe8477 Update shader names to be more representative. 2023-08-29 11:57:41 +01:00
Michael Parkin-White d98dbddd46 Formatting pass. 2023-08-24 13:02:41 +01:00
Michael Parkin-White 8c8ca84396 Remove accidentally added layer usage bits. 2023-08-24 13:01:42 +01:00
Michael Parkin-White 6b6586a1f0 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-08-24 11:55:55 +01:00
Michael Parkin-White a8be1aaf58 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-08-22 14:24:48 +01:00
Michael Parkin-White 32fbb050d6 Merge branch 'main' into eevee_next_metal_shadow_opti_tbdr 2023-08-21 22:05:27 +01:00
Michael Parkin-White 02ad47d133 Add static compilation 2023-08-21 22:04:52 +01:00
Michael Parkin-White 8bdee8bdab Additional VSM optimizations for Apple Silicon:
- Prepass to clear depth to zero for pages which will not be updated. Further reducing fragment cost.

- Removal of SHADOW_PAGE_CLEAR compute pass for Metal, as this can be handled more efficiently within the geometry update pass.

- Addition of support for F32 shadow atlas for Metal instead of U32, subtly improving shadow update perf.

These changes are not yet productised, still some further work to do on updating descriptions and cleaning up approaches for some of these passes.
2023-08-21 16:42:54 +01:00
Michael Parkin-White ffea964761 Ensure createinfo's using gpu_Layer are correctly tagged 2023-08-19 12:19:40 +01:00
Michael Parkin-White f4827c8ff2 Metal: EEVEE Next: Optimize Virtual shadow maps for Apple Silicon
Opening WIP PR for optimization and implementation of EEVEE Next's
Virtual Shadow Maps for TBDRs. The core of these optimizations lie in
eliminating use of atomic shadow atlas writes and instead utilise tile
memory to perform depth accumulation as a secondary pass once
all geometry updates for a given shadow view have been updated.

This also allows use of fast on-tile depth testing/sorting, reducing
overdraw and redundant fragment operations, while also allowing
for tile indirection calculations to be offloaded into the vertex
shader to increase fragment storage efficiency and throughput.

Authored by Apple: Michael Parkin-White
2023-08-18 21:19:09 +01:00