User:MiguelPozo/WeeklyReports/2022

Week 1 (Oct 03 - 09)
Started working on the Workbench port to the new DRWManager (T101619). Just basic progress for now, mainly getting familiar with the code: Other:
 * Fixed compilation issues and crashes.
 * Added UI support for Workbench Next.
 * Added support for some of the color modes, flat shading, background color, and backface culling.
 * Fixed material encoding.
 * Started refactoring the code (uncommitted).
 * Fixed D16129 and D16134.
 * Helped with T99356 and T101175.

Week 2 (Oct 10 - 16)
Kept working on the Workbench port (T101619).
 * Got all the Lighting (Studio, Matcap, Flat) and Color (Material, Object, Attribute, Single, Random, Texture) modes fully working.
 * Got all the logic for selecting the correct drawing mode based on settings, object mode, and material properties fully working.
 * Implemented "In Front" rendering for the Opaque Pass.
 * Optimized the Opaque Pass to use a single depth texture and avoid unnecessary overdraws when In Front is in use.
 * Added support for Metallic/Roughness material properties in Texture mode.
 * When Workbench Next is the scene render engine, it will be used on Wire/Solid modes too (Needed for testing some features).

Week 3 (Oct 17 - 23)
More work on the Workbench port (T101619).
 * Implemented Cavity/Curvature (Now is part of the main resolve/composite opaque pass).
 * Implemented XRay/Transparency, including "In Front" support.
 * Implemented the Transparency Depth/Id passes (needed for Outline and DoF).
 * Implemented the Outline pass (needs refactor).
 * Refactored the SceneResources setup.

Week 4 (Oct 24 - 30)
More work on the Workbench port (T101619).
 * Implemented DoF.
 * Implemented TAA.
 * Refactored most of the draw settings logic into its own class (DrawConfig).

Week 5 (Oct 31 - Nov 06)
More work on the Workbench port (T101619), mostly refactoring and cleaning up before starting to submit diffs.
 * Implemented the feedback I got about naming and Blender C++ code conventions from Clément. (ie. DrawConfig is now SceneState)
 * Moved the sample accumulation logic from the AntiAliasingPass to SceneState (since it's used by DoF and Cavity too).
 * Moved jitter_tx from CavityPass to SceneResources (since it's used by DoF too).
 * Implemented Clipping Borders.
 * Initial work (uncommitted) on Stencil Shadows and Image Render.

Week 6 (Nov 07 - 13)
Bug fixing week.
 * Fixed DoF in EEVEE when a non-camera object is the active camera (T101533). Similar (non reported) issues were present in Workbench, EEVEE Next and Workbench Next and were fixed too. (Main fix, EEVEE Next, Workbench Next)
 * Fixed a performance regression in EEVEE related to Bump Node codegen (T98989). The same issue was also causing crashes on AMD (T99120). (Fix)
 * Improved the generated variable names in shaders for easier debugging (uncommitted, needs feedback).
 * Investigated and closed/discarded T102308, T93507, T92377 and T101445.

Week 7 (Nov 14 - 20)
More bug fixing.
 * Worked on implementing custom int attributes support for the draw manager. Reworked the way the GPU subdivision shaders are cached/retrieved.The previous method ignored the defines parameter after the first shader compilation. (T102076) (D16420) (needs review)
 * Added support for optimizing-out unused inputs in Mix nodes (ie. when the mix factor is 0 or 1). Needed to avoid setting wrong/unwanted material flags. (T100904) (D16533) (needs review)
 * Fixed an issue with shadow maps bounds ignoring the light "Volume Factor" (T101965) (D16513).
 * Updated the EEVEE modulo node to match Cycles/OSL behavior (T101562) (D16497).
 * Improved the name of code-generated shader variables in debug builds (D16496).
 * Investigated and closed/discarded T100420, T97024 and T101197.

Week 8 (Nov 21 - 27)
More bug fixing. Focused on high-priority reports.
 * Committed the fix for custom int attributes. (T102076) (D16420) Fixed two related regressions introduced with that fix. (T102773, T102777)
 * Updated Color attributes to use 32-bit floats. (commit) (Byte Color attributes are still a normalized uint16)
 * Fixed volume transforms in EEVEE. (T101402) (D16607) This required figuring out how to debug final image renders. Nvidia Nsight with the Frame Delimiter mode to Finish (glFinish) turned out to work well for this purpose.
 * Worked on a fix for showing selected vertices in paint mode when GPU Subdivision is enabled. (T102519) (D16594) (not committed yet)
 * Investigated other issues related to GPU Subdivision. (T99629, T102215)

Week 9 (Nov 28 - Dec 04)
Back to work on the Workbench port. :)


 * Finished and committed (T102519) D16594.
 * Implemented support for image rendering (F12) for Workbench Next, including the Z pass. (commit)
 * Initial support for Stencil Shadows in Workbench Next. Still W.I.P., none of the planned improvements have been implemented yet. (commit)

Week 10 (Dec 05 - 11)
A somewhat unproductive week (Tuesday and Thursday were holidays)


 * Fixed a 3.4 crash (T102965)
 * Fixed the Stencil Test Fail method in Stencil Shadows for Workbench Next. (commit)
 * Tried to implement the "no_geom" version of Stencil Shadows used for the Metal backend. However, it relies on a #pragma directive (USE_SSBO_VERTEX_FETCH) that's only implemented in the Metal backend. How to support this feature across backends is still TBD.
 * Initial (WIP) implementation of Compute Shader based culling for Stencil Shadows. This feature needs changes in the View API to allow custom culling, the exact why to support it is still TBD.

Week 11 (Dec 12 - 18)
Continued the work on Workbench Next Stencil Shadows:


 * Most CPU-side computations have been moved to the GPU (DRW_drawdata is no longer used): Shadow volume culling is now more precise (using an extruded frustum) and has been moved to the GPU. The code for the Stencil method selection (Pass or Fail) has been simplified and moved to the GPU as well. (There's one remaining issue to be fixed when the Fail method is selected directly on the CPU side (ie. when the object is transparent or non-manifold)) Extrude distance is now computed directly in the Vertex Shader.
 * Stencil Shadows and In Front rendering have been updated so they work well together.

Week 12 (Dec 19 - 25)
Prepared the Workbench Next patch for review (D16826):


 * Some minor fixes and clean-ups.
 * Focus on testing and profiling (Workbench Next is currently slightly slower than Workbench). Tested several profiling tools to figure out their pros/cons and reliability.
 * Made a patch to retrieve and print GPU, CPU and Latency timings for GPU Debug Groups (OpenGL only). (Uncommitted, needs feedback)

Week 13 (Dec 26 - Jan 01)
Further focus on testing and optimization for Workbench Next: Performance is now almost on par with the current Workbench engine (with the exception of shadow rendering, which can be quite faster). The main bottleneck is on the CPU side and since most of the overhead comes from elsewhere, I've created a new branch to test experimental improvements outside the Workbench itself:
 * Updated shadows to not use push constants, since it was a major bottleneck. (commit)
 * Converted the Opaque Resolve pass back to a full-screen triangle pass for improved performance. (commit)
 * Minor clean-ups.
 * Included the previously mentioned patch that provides GPU, CPU, and Latency timings to GPU Debug Groups. (commit).
 * Tweaked the GPU debug logging so it can be disabled for profiling (blender --debug-gpu --log-level -1) (commit).
 * Disabled the use of glClearTexImage since, under my testing, it can be up to 10x slower than glClear (commit).
 * Found a major bottleneck with DupliObject instances. The depsgraph removes their runtime bounding box and, while the bbox itself is not re-computed, the draw manager mallocs and copies the result for every single instance. This should be easy to fix, but I couldn't figure out how to do it on my own.