Skip to content

Conversation

@google-labs-jules
Copy link

This PR implements OpenMP parallelization for CustomWaveform rendering and stb_image_write PNG encoding, as suggested in docs/openmp.md.

Changes:

  • vendor/SOIL2/src/SOIL2/stb_image_write.h: Parallelized the main row loop in stbi_write_png_to_mem using #pragma omp parallel for. Moved line_buffer allocation inside the parallel region to ensure thread safety. Added failure handling via atomic flag.
  • vendor/SOIL2/CMakeLists.txt: Added logic to link OpenMP::OpenMP_C and define PRJM_ENABLE_OPENMP for the SOIL2 target if ENABLE_OPENMP is ON.
  • src/libprojectM/MilkdropPreset/CustomWaveform.cpp:
    • In Draw, added a check for !m_perPointContext.perPointCodeHandle. If no per-point code is present, a parallel loop generates vertices using local logic (bypassing the shared PerPointContext).
    • In SmoothWave, parallelized the loop by removing stateful dependency variables (iBelow, iAbove2) and calculating them directly from the loop index.

These changes are guarded by PRJM_ENABLE_OPENMP.


PR created automatically by Jules for task 3007410145637072838 started by @ford442

Implemented OpenMP parallelization for:
1. CustomWaveform::Draw: Added a parallel path for waveforms without per-point code, replicating the default vertex generation logic to avoid shared state contention.
2. CustomWaveform::SmoothWave: Parallelized the smoothing loop by calculating dependency indices locally.
3. stbi_write_png (SOIL2): Parallelized the PNG line filtering loop, ensuring thread-local scratch buffers.

Also updated vendor/SOIL2/CMakeLists.txt to link OpenMP::OpenMP_C when enabled.
@google-labs-jules
Copy link
Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@ford442 ford442 marked this pull request as ready for review January 21, 2026 08:33
@ford442 ford442 merged commit 59e2109 into jules-1-14-26 Jan 21, 2026
37 of 38 checks passed
@ford442 ford442 deleted the feature/openmp-custom-wave-stbi-3007410145637072838 branch January 21, 2026 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant