EEVEE-Next: Fix motion blur large geom on iGPU HD520 devices #120915

Open
Jeroen Bakker wants to merge 8 commits from Jeroen-Bakker/blender:eevee/fix/copy-velocity-groups into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

Detected when testing mr_elephant on an Intel HD520. When copying
the velocity buffer using the copy shader, the number of scheduled
workgroups could be larger than supported by the device.

This PR fixes this by copying multiple vertices per thread when
the work size cannot cover all the pixels.

Detected when testing mr_elephant on an Intel HD520. When copying the velocity buffer using the copy shader, the number of scheduled workgroups could be larger than supported by the device. This PR fixes this by copying multiple vertices per thread when the work size cannot cover all the pixels.
Jeroen Bakker added this to the 4.2 LTS milestone 2024-04-22 10:11:57 +02:00
Jeroen Bakker added the
Module
EEVEE & Viewport
label 2024-04-22 10:11:57 +02:00
Jeroen Bakker self-assigned this 2024-04-22 10:11:57 +02:00
Jeroen Bakker added 1 commit 2024-04-22 10:12:04 +02:00
74b128dd6d EEVEE-Next: Fix motion blur large geom on low end devices
Detected when testing mr_elephant on an Intel HD520. When copying
the velocity buffer using the copy shader, the number of scheduled
workgroups could be larger than supported by the device.

This PR fixes this by splitting the copy pass in multiple smaller
passes so the velocity is copied.

NOTE: I didn't went for the approach to add a new workgroup dimension
as that would lead to more overhead when using more smaller meshes. I
would assume these devices would more often be used with scenes with
smaller geometry.
Jeroen Bakker added this to the EEVEE & Viewport project 2024-04-22 10:12:11 +02:00
Jeroen Bakker requested review from Clément Foucault 2024-04-22 10:20:10 +02:00
Jeroen Bakker changed title from EEVEE-Next: Fix motion blur large geom on low end devices to EEVEE-Next: Fix motion blur large geom on iGPU HD520 devices 2024-04-22 10:23:56 +02:00
Author
Member

I also tried

int vertices_per_call = VERTEX_COPY_GROUP_SIZE * GPU_max_work_group_count(0);
      for (int sub_offset = geom.ofs, sub_len_left = geom.len; sub_len_left > 0;
           sub_offset += vertices_per_call, sub_len_left -= vertices_per_call)
      {

but didn't like the readability.

I also tried ``` int vertices_per_call = VERTEX_COPY_GROUP_SIZE * GPU_max_work_group_count(0); for (int sub_offset = geom.ofs, sub_len_left = geom.len; sub_len_left > 0; sub_offset += vertices_per_call, sub_len_left -= vertices_per_call) { ``` but didn't like the readability.
Clément Foucault requested changes 2024-04-22 10:55:16 +02:00
Clément Foucault left a comment
Member

I would rather have the for loop inside the shader. This will reduce the amount of command send.

I would rather have the for loop inside the shader. This will reduce the amount of command send.
Jeroen Bakker added 2 commits 2024-04-23 10:53:59 +02:00
Jeroen Bakker added 1 commit 2024-04-23 11:28:53 +02:00
Jeroen Bakker added 1 commit 2024-04-23 11:43:05 +02:00
Jeroen Bakker added 1 commit 2024-04-23 12:19:50 +02:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
740c0b3d4c
Fix division.
Jeroen Bakker requested review from Clément Foucault 2024-04-23 12:21:05 +02:00
Author
Member

@blender-bot build

@blender-bot build
Clément Foucault requested changes 2024-04-30 11:10:31 +02:00
@ -2,14 +2,19 @@
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma BLENDER_REQUIRE(common_math_lib.glsl)

Do not use this header. Use gpu_shader_math_base_lib.glsl instead. common_math_lib is legacy.

Do not use this header. Use `gpu_shader_math_base_lib.glsl` instead. `common_math_lib` is legacy.
Jeroen-Bakker marked this conversation as resolved
@ -46,6 +46,7 @@ GPU_SHADER_CREATE_INFO(eevee_vertex_copy)
.push_constant(Type::INT, "start_offset")
.push_constant(Type::INT, "vertex_stride")
.push_constant(Type::INT, "vertex_count")
.additional_info("eevee_shared")

Don't use that only for the group size. Use gl_WorkGroupSize instead.

Don't use that only for the group size. Use `gl_WorkGroupSize` instead.
Jeroen-Bakker marked this conversation as resolved
Jeroen Bakker added 2 commits 2024-05-06 08:27:59 +02:00
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
91c5533cb1
Use gl_WorkGroupSize.x
Jeroen Bakker requested review from Clément Foucault 2024-05-06 08:28:30 +02:00
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR120915) when ready.
All checks were successful
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u eevee/fix/copy-velocity-groups:Jeroen-Bakker-eevee/fix/copy-velocity-groups
git checkout Jeroen-Bakker-eevee/fix/copy-velocity-groups
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#120915
No description provided.