GPv3: Implement Wireframe batch #127147

Merged
Clément Foucault merged 5 commits from fclem/blender:grease-pencil-wireframe into main 2024-09-06 16:50:40 +02:00

Started from a copy of grease_pencil_weight_batch_ensure
and simplified it. Might be too complex for what it does.

Would appreciate if reviewer can check if we can simplify
this (or make it clearer).

Fix #120604

Started from a copy of `grease_pencil_weight_batch_ensure` and simplified it. Might be too complex for what it does. Would appreciate if reviewer can check if we can simplify this (or make it clearer). Fix #120604
Clément Foucault added this to the 4.3 milestone 2024-09-04 16:00:38 +02:00
Clément Foucault added 1 commit 2024-09-04 16:00:48 +02:00
Hans Goudey reviewed 2024-09-04 16:04:22 +02:00
@ -1296,0 +1354,4 @@
drawing_start_offset += 1;
for (const int point_i : IndexRange(points.size())) {
GPU_indexbuf_add_generic_vert(&elb, point_i + drawing_start_offset);
Member

Seems worth calculating the size first, then using GPU_indexbuf_get_data and filling the data in parallel. These GPU_indexbuf_add_generic_vert calls really show up in profiles

Seems worth calculating the size first, then using `GPU_indexbuf_get_data` and filling the data in parallel. These `GPU_indexbuf_add_generic_vert` calls really show up in profiles
Author
Member

Do you have any container preference for storing the sizes?

Do you have any container preference for storing the sizes?
Author
Member

I used Vectors for now, if there is a better practice let me know.

I used `Vector`s for now, if there is a better practice let me know.
Member

TBH just writing the data directly and leaving parallelization later would be fine for now IMO. To parallelize it we'd need to store offsets per stroke since they can be hidden. Doesn't quite seem worth it right now.

TBH just writing the data directly and leaving parallelization later would be fine for now IMO. To parallelize it we'd need to store offsets per stroke since they can be hidden. Doesn't quite seem worth it right now.
Member

Or that's fine too I suppose!

Or that's fine too I suppose!
Member

Though generally a better practice for storing a sequence of offsets is using integers and OffsetIndices

Though generally a better practice for storing a sequence of offsets is using integers and `OffsetIndices`
Author
Member

Should be fine now I think.

Should be fine now I think.
Clément Foucault added 1 commit 2024-09-04 18:46:19 +02:00
Clément Foucault requested review from Falk David 2024-09-04 18:49:56 +02:00
Clément Foucault requested review from Hans Goudey 2024-09-04 18:49:56 +02:00
Clément Foucault added 2 commits 2024-09-04 19:12:29 +02:00
Hans Goudey approved these changes 2024-09-04 19:14:46 +02:00
Hans Goudey reviewed 2024-09-04 19:15:50 +02:00
@ -1296,0 +1330,4 @@
object, info.drawing, memory);
visible_strokes.foreach_index([&](const int curve_i) {
IndexRange points = points_by_curve[curve_i];
Member

const IndexRange points

`const IndexRange points`
fclem marked this conversation as resolved
@ -1296,0 +1349,4 @@
blender::MutableSpan<uint32_t> indices = GPU_indexbuf_get_data(&elb);
threading::parallel_for(cyclic_per_curve.index_range(), 1024, [&](const IndexRange range) {
for (const int i_curve : range) {
Member

i_curve -> curve

`i_curve` -> `curve`
fclem marked this conversation as resolved
@ -1296,0 +1351,4 @@
threading::parallel_for(cyclic_per_curve.index_range(), 1024, [&](const IndexRange range) {
for (const int i_curve : range) {
/* Drop the trailing restart index. */
IndexRange offset_range = range_per_curve[i_curve].drop_back(1);
Member

const IndexRange

`const IndexRange`
fclem marked this conversation as resolved
@ -1296,0 +1355,4 @@
/* Shift the range by i_curve to account for the second padding vertices.
* The first one is already accounted for during counting (as primitive restart). */
IndexRange index_range = offset_range.shift(i_curve + 1);
for (const int i : IndexRange(offset_range.size())) {
Member

offset_range.index_range()

`offset_range.index_range()`
Author
Member

This is weird semantically but ok.

This is weird semantically but ok.
fclem marked this conversation as resolved
Member

Hummm seems to work 🤔

Hummm seems to work 🤔
Clément Foucault added 1 commit 2024-09-06 16:21:42 +02:00
Address review
All checks were successful
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
f88fd7c620
Author
Member

@blender-bot build

@blender-bot build
Clément Foucault merged commit dc89c935fa into main 2024-09-06 16:50:40 +02:00
Clément Foucault deleted branch grease-pencil-wireframe 2024-09-06 16:50:43 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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 project
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#127147
No description provided.