Commit Graph
71 Commits
Author SHA1 Message Date
Mike-Solar b0aa683499 fix: dangling OpenGL context crash and uninitialized audio frame size
- OpenGLRenderer: hold the viewer-owned QOpenGLContext in a QPointer so
  DestroyInternal() safely skips it when the context has already been
  destroyed by Qt's shared-context lifecycle. Fixes a SIGSEGV when the
  full gtest suite ran MainWindow.ConstructsOffscreenWithPanelsAndMenus
  after earlier viewer tests.
- PreviewAudioDevice: add SetParams() deriving bytes_per_frame from the
  audio format (bytes per sample * channel count) instead of staying 0.
2026-07-19 13:58:06 +08:00
Mike-Solar e5eeaddf2f format: reformatting files 2026-07-13 15:30:43 +08:00
Mike-Solar 51ea3ca24e Use 10-bit packed preview format and add OCIO LUT regression tests
Renderer / preview:
- Switch the preview/display readback format from F16 to packed
  10-bit RGBA (PixelFormat::U10) to halve GPU->CPU/IPC bandwidth
  while keeping 10-bit panel precision.
- Add U10 support to VideoParams, FFmpeg/OIIO/OCIO utility mappings,
  OpenGL (GL_RGB10_A2), Vulkan (VK_FORMAT_A2B10G10R10_UNORM_PACK32),
  and plugin bit-depth lookups.
- Update preview autocacher comment to reflect the new behavior.

OCIO LUT tests:
- Add four E2E-style ColorLutNode gtests that drive a SolidGenerator
  -> OCIOLutNode graph through NodeTraverser and compare resulting
  pixels on the CPU. They cover forward/inverse transforms and verify
  that switching LUT direction and LUT file updates both the processor
  and the output pixels.

Cleanup:
- Remove a leftover SolidGenerator::Value debug fprintf.
- Capture render worker stderr in RenderWorkerFootageTest for better
  diagnostics.
2026-07-13 10:19:30 +08:00
Mike-Solar f6211f97a5 Fix render worker reuse and stabilize out-of-process video rendering 2026-07-13 10:19:30 +08:00
Mike-Solar 30e7153154 fix Windows and macOS symbol error 2026-07-13 10:19:30 +08:00
Mike-Solar e77de49406 add Comments 2026-07-13 10:19:30 +08:00
Mike-Solar 3c9592da45 完成Vulkan渲染后端 2026-07-13 10:19:30 +08:00
Mike-Solar 225f8505c2 feat(render): dynamic OpenGL/Vulkan backend split and backend-neutral viewer
- Extract libolive-rendercore static library to minimize backend link boundary.
- Add DynamicRenderer adapter with C ABI (oakgl/oakvulkan shared libs).
- Make OAK_ENABLE_DYNAMIC_RENDER_BACKEND default ON with OpenGL fallback.
- Implement VulkanRenderer prototype (textures, shaders, UBO blit, readback).
- Add backend-neutral viewer readback path (offscreen -> QImage -> QPainter).
- Refactor PluginRenderer to be renderer-agnostic; OFX plugins fall back to CPU
  path on non-OpenGL backends while preserving OpenGL render path.
- Add Renderer::AttachOutputTexture/DetachOutputTexture and C ABI forwards.
- Update docs/zh/render-backend-dynamic-plan.md for Phase 3/4/5.
2026-07-13 10:19:29 +08:00
Mike-Solar 2a84027ff9 fix(renderer): macOS TBDR cross-context sync and OFX instance thread-safety
This commit fixes crashes (SIGSEGV in CImg blur_bilateral) and black-frame
corruption artifacts during playback and scrubbing on macOS Apple Silicon.

Root cause analysis:
1. macOS uses Tile-Based Deferred Rendering (TBDR). glFlush() does not
   guarantee tile memory writeback, causing glReadPixels to read incomplete
   tiles (black/corrupted frames) and cache them to disk.
2. Olive uses multiple shared OpenGL contexts (RenderProcessor contexts vs.
   thread-local PluginRenderer context). glFinish() only waits for the
   current context, not the shared context that produced the texture. CPU
   readback in PluginRenderer could read partially-rendered tiles.
3. OlivePluginInstance and OliveClipInstance are not thread-safe. Concurrent
   RenderProcessors could corrupt internal QMap/images_ and params_ via
   setInputTexture/renderAction races.

Fixes:
- OpenGLRenderer::Flush() on macOS now uses glFinish() unconditionally.
- OpenGLRenderer::DownloadFromTexture() and OpenGLRenderer::Blit() insert
  glFinish() before readback/detach to ensure tile writeback completes.
- PluginRenderer::RenderPlugin() now acquires a per-instance mutex to
  serialize concurrent OFX render calls.
- Before CPU readback in PluginRenderer, flush the renderer that originally
  produced each input texture, ensuring cross-context synchronization.
- RenderProcessor::ProcessVideoFootage() flushes after BlitColorManaged.
- Add black-frame detection in ProcessVideoCacheJob() to auto-purge TBDR-
   corrupted cache files.
- Add diagnostic qDebug() logging in viewer, decoder, renderer, and plugin
  paths to aid future debugging.
2026-05-17 14:54:49 +08:00
Mike-Solar bfb1b2fce4 update copyright back 2026-01-16 21:22:05 +08:00
Mike-Solar e851653fa3 尝试修复粉紫屏未果 2026-01-16 21:11:24 +08:00
Mike-Solar 4d393f3d23 尝试解决插件bug 2026-01-10 18:56:58 +08:00
Mike-Solar b8669f6a11 Change project name; 2026-01-05 16:22:26 +08:00
Mike-Solar cdc66d1a02 fix no video shown 2026-01-05 13:52:02 +08:00
Mike Solar 7c0f37b0a7 Implement default methods for plugin parameter editing and progress, and integrate plugin rendering into the build system. 2025-12-24 21:07:17 +08:00
Mike Solar 6fdfd03ffd update: update copyright 2025-08-05 17:12:49 +08:00
Mike Solar 74f73ab3be change: change code style to Linux style except indent. 2025-08-03 03:09:40 +08:00
itsmattkc ffec819eef successfully transmit block map
Requires a binary data type, which requires a new project serializer
2023-02-20 14:56:04 -08:00
itsmattkc c1c6893713 various: moved more to core lib 2023-01-19 16:01:31 -08:00
itsmattkc dd9c52ab59 start moving core frameworks to external libraries 2023-01-19 09:51:47 -08:00
itsmattkc 1c4149a0fd preferences: add option to use glFinish
i hate opengl i hate opengl i hate opengl i hate opengl i hate opengl i hate opengl i hate opengl i hate opengl i hate opengl i hate opengl i hate opengl i hate opengl i hate opengl i hate opengl
2022-11-05 12:49:30 -07:00
itsmattkc b76e9cbdbe openglrenderer: revert back to glFlush
Just can't win with this one. I started with glFinish because it's technically the correct option, however it caused issues on a GPU, so I switched it out for glFlush. Then I started noticing other frame sync oddities that would be fixed by using glFinish, so I switched back. Now, not only is it causing GPU issues on one system, it seems to be causing GPU issues on others too. So now glFlush seems like the lesser of the two evils, and I'm just going to have to find a way around the aforementioned frame sync issues.
2022-10-11 00:31:12 -07:00
itsmattkc c0d8ff403f nodes: rework so that jobs can be completely deferred
Big optimization requiring a lot of refactoring.
2022-09-24 18:44:59 -07:00
itsmattkc 81b7c79a14 openglrenderer: use glFinish again...
This will break some systems, but is necessary for frames not to corrupt under some circumstances. It sucks but that's the tradeoff we have to make.

I think it's time to get off OpenGL. It's not worth it anymore.
2022-09-23 17:53:43 -07:00
itsmattkc cc7893e7bc opengl: use flush instead of finish
I may live to regret this, but it helped significantly on at least one system. Hopefully it doesn't break a bunch of others...
2022-08-08 14:21:01 -07:00
itsmattkc a09d2f41e9 opengl: disable mutex
Shouldn't really need this anymore and it fixes a deadlock
2022-07-26 12:40:00 -07:00
itsmattkc 07f63ddc17 renderer: reinstated new and improved texture cache 2022-07-26 10:12:19 -07:00
itsmattkc e3403a5a53 render: create less textures 2022-07-26 09:40:26 -07:00
itsmattkc a6d1ec99a8 opengl: remove old geriatric texture cache 2022-07-11 19:03:37 -07:00
itsmattkc 7493395103 implemented drop shadow node 2022-05-15 11:06:23 -07:00
itsmattkc 83e7707025 media: implement importing SRT files 2022-05-11 13:48:59 -07:00
itsmattkc 4b366a9b73 update copyright year to 2022 2022-05-10 10:38:56 -07:00
itsmattkc b88e15b8cf accleratedjob: simplified function calls 2022-05-09 15:16:46 -07:00
itsmattkc 58c4600d04 nodevalue: begin abstracting qvariant 2022-05-09 13:07:34 -07:00
itsmattkc 028d2fd60c nodes: optimize job infrastructure
Rework traversing so that jobs are only resolved when they are used. This should provide moderate optimize to the traversing process.
2022-05-03 11:19:21 -07:00
itsmattkc ac1c4733ac various: added now-missing includes 2022-05-02 10:32:17 -07:00
itsmattkc 3aafb2466d Squashed commit of the following:
commit f05b5b3ff8286f6252c2a3f3c8c367f8a5b821b5
Author: itsmattkc <34096995+itsmattkc@users.noreply.github.com>
Date:   Tue Apr 12 13:05:25 2022 -0700

    final consistency modifications

commit 4f27718d46de9660822eb197b0e900be947ec515
Author: itsmattkc <34096995+itsmattkc@users.noreply.github.com>
Date:   Tue Apr 12 11:40:58 2022 -0700

    opengl: don't set texture options for null texture

commit bb54cfcf4e219e1cbf1ecc6b5552cca75e6e1573
Author: itsmattkc <34096995+itsmattkc@users.noreply.github.com>
Date:   Tue Apr 12 11:40:29 2022 -0700

    rename inputs

commit e5ac8fffa2ac15f5549b6da5f42b05659c6d020f
Author: itsmattkc <34096995+itsmattkc@users.noreply.github.com>
Date:   Tue Apr 12 10:37:23 2022 -0700

    change alpha association formula

commit dee09a88f17552e3f98be8940966822e45d6df4f
Author: itsmattkc <34096995+itsmattkc@users.noreply.github.com>
Date:   Tue Apr 12 10:36:58 2022 -0700

    glsl: use constants to improve readability

commit aedc75ebee11b61198f29c464501a2ddb0506129
Author: itsmattkc <34096995+itsmattkc@users.noreply.github.com>
Date:   Tue Apr 12 10:36:26 2022 -0700

    changed id capitalization

commit 470b2bb85b51c4a57c109d3fb230088a81024277
Author: itsmattkc <34096995+itsmattkc@users.noreply.github.com>
Date:   Tue Apr 12 10:35:53 2022 -0700

    node: update categories

commit c78dacad82051dfbb3e40c92cfaf456dbff2de0d
Author: itsmattkc <34096995+itsmattkc@users.noreply.github.com>
Date:   Tue Apr 12 09:22:57 2022 -0700

    updated shaders to es 3

commit 1e7544be93e55916c94cd91629ec5eef728bfad8
Merge: 1bbb8d7f9 25d019609
Author: itsmattkc <34096995+itsmattkc@users.noreply.github.com>
Date:   Tue Apr 12 09:02:32 2022 -0700

    Merge branch 'master' into pr/1818

commit 1bbb8d7f9acd75cb4498733f105fbe0487c0db9c
Author: brimson <40442071+brimson@users.noreply.github.com>
Date:   Tue Jan 18 18:36:24 2022 -0700

    Simplify colordifferencekey.frag

    Avoiding extra MOV instruction

commit c7cf1021ce5a3d090833e94e4bc212cc51a61a2a
Author: brimson <40442071+brimson@users.noreply.github.com>
Date:   Tue Jan 18 11:43:02 2022 -0700

    Revert switch-case changes

    Thanks Simran, MattKC, and Wilshaw for the clarifications

commit 882ffeede01b81f0cb4dfd885ba05bf66119ac7e
Author: brimson <40442071+brimson@users.noreply.github.com>
Date:   Tue Jan 18 00:06:31 2022 -0700

    Optimize despill shader

    Turn previous averaging from (1 MAD + 1 MUL) to (1 DP2), reuse the result to prevent recalculation.

commit 0c93f519977fa34840ab03d51addcf2456f931d8
Author: Thomas Wilshaw <thomaswilshaw@gmail.com>
Date:   Sat Jan 8 17:23:49 2022 +0000

    Cleanup

commit 222560ce1a4666899b1111854d4d549dd7ba1357
Merge: 96e21c2b4 d3ffeaa35
Author: ThomasWilshaw <thomaswilshaw@gmail.com>
Date:   Tue Jan 4 23:50:39 2022 +0000

    Merge branch 'master' into color_key

commit 96e21c2b43db3bf1051aca696970509292159548
Author: Thomas Wilshaw <thomaswilshaw@gmail.com>
Date:   Tue Jan 4 23:45:26 2022 +0000

    Rename and reoganise keying nodes

commit 6d42ed23a69ebdb1f5b399957f0b37434d0519dd
Author: Thomas Wilshaw <thomaswilshaw@gmail.com>
Date:   Tue Jan 4 23:04:50 2022 +0000

    Move despill code to it's own node

commit e97ab2e16fd1d4e2f2ff145b8c023ff0e1ee451e
Author: Thomas Wilshaw <thomaswilshaw@gmail.com>
Date:   Mon Jan 3 21:39:48 2022 +0000

    Add option for blue screens

commit 2346f44e5af48bb9547c77c4c08ee7abfcb09393
Author: Thomas Wilshaw <thomaswilshaw@gmail.com>
Date:   Mon Jan 3 21:14:55 2022 +0000

    Optimise node slightly

commit 446522edcf63525fafe7a97cf6d59b7ea0385460
Author: Thomas Wilshaw <thomaswilshaw@gmail.com>
Date:   Mon Jan 3 21:10:03 2022 +0000

    Fix GL ES compile error

commit a765ce6c6f3e0c0e996f08e2a3ef1101818098e8
Author: Thomas Wilshaw <thomaswilshaw@gmail.com>
Date:   Sun Jan 2 18:27:24 2022 +0000

    Cleanup

commit d268e0645df34aa306dc391d1dc10bf335524f94
Author: Thomas Wilshaw <thomaswilshaw@gmail.com>
Date:   Sun Jan 2 18:03:26 2022 +0000

    Fix core matte and change Darks start value

commit 30b024dc5f59dd60ffc5012eee7a79201ed4f9c3
Author: Thomas Wilshaw <thomaswilshaw@gmail.com>
Date:   Sun Jan 2 17:26:39 2022 +0000

    Change matte controls and cleanup

commit b742a9ba7ed651785a0781289a4c03fd4fb72e03
Author: Thomas Wilshaw <thomaswilshaw@gmail.com>
Date:   Sun Jan 2 16:31:41 2022 +0000

    Add a core and garbage matte

commit f814d036b61b8de090df4c1f080c124b98b432d6
Author: Thomas Wilshaw <thomaswilshaw@gmail.com>
Date:   Sun Jan 2 03:31:20 2022 +0000

    Improve basic keyer

commit 4995ec3b9b92c9b4cb0dc31a247d585b2a47e408
Author: Thomas Wilshaw <thomaswilshaw@gmail.com>
Date:   Sun Jan 2 00:23:18 2022 +0000

    Start simple color key node
2022-04-12 13:05:45 -07:00
itsmattkc d7b3c523f4 groups: improved serialization
Introduced new project version with extra customization for groups
2022-04-04 00:03:57 -07:00
itsmattkcandThomas Wilshaw a4056d8454 Upgrade to OpenGL ES 3.2 (#1879)
* upgrade to opengl 3.2

* cornerpin: no need for hack

* renderer: Update OCIO shader language to ES 3.0

Co-authored-by: Thomas Wilshaw <thomaswilshaw@gmail.com>
2022-03-20 11:17:18 -07:00
itsmattkc 43cef6e332 opengl: set texture wrap R on 3D textures 2022-03-10 12:22:14 -08:00
ThomasWilshawanditsmattkc f5b4729a19 Corner pin (#1851)
* Start adding a corner pin node

* Start gizmo support

* Correctly setup QVector2d inputs

* Missing breaks were causing incorect data to be set

* Add ability to override vertex coords

* Get perspective pin working

* Cleanup

* Add none perspective corner pin

* Small optimisation

* Improve comments, clean up and fix bug in job optimisation

* [skip ci] cornerpin: Improve description

* Move GL extension from shader to standard preamble.

* Use #version 130 for mobile GPU compatibility

* Cache half resolution

* Use built in NodeInputDragger::GetStartValue

* Pass cnst references to avoid deep copies

Co-authored-by: itsmattkc <itsmattkc@gmail.com>
2022-03-02 19:38:12 -08:00
itsmattkc 3f7381f7cb PolygonGenerator: Finished main implementation
It's been 84 years, but the polygon generator not only works, but now has bezier support. The UI could still use some work, but this was the hardest part. I guess complex masking should be possible now, if perhaps slightly cumbersome until the UI is smoothed out.
2022-01-24 22:17:19 -08:00
itsmattkc d40d497379 opengl: is src is single channel and dest is RGB, swizzle G and B 2021-10-21 11:04:33 -07:00
itsmattkc a0706a78d8 nodes: implemented core of manual table value selection 2021-09-07 15:27:07 -07:00
itsmattkc 6d576a3e55 opengl: use desktop header on mac
Fixes #1741
2021-09-06 11:01:07 -07:00
itsmattkc 90af822bf0 opengl: use correct shader version 2021-09-03 15:10:11 -07:00
itsmattkc 5e66892e64 rewrite shader compilation code
Fixes #1737
2021-09-03 13:30:22 -07:00
itsmattkc ae3393f031 opengl: use shared contexts and downgrade to ES 2.0 (BIG CHANGE)
If you run into new OpenGL issues, this is likely the commit that caused it.
I've tested this on as many systems as I have access to (including AMD, Apple,
Intel, and NVIDIA GPUs with a mixture of Windows, Linux, and macOS) and it
appears to work fine, however we all know how unpredictable GPUs can be.
This should help increase GPU performance and compatibility.

Squashed commit of the following:

commit fa3c0ac7c469aebe2941a803736bdc06cdd5a2d8
Author: itsmattkc <itsmattkc@gmail.com>
Date:   Thu May 27 13:17:44 2021 +1000

    viewer: updated pixel sampling for shared contexts

commit 9334261da235f09cb67b193c5bb6169abd7a95f7
Author: itsmattkc <itsmattkc@gmail.com>
Date:   Thu May 27 13:12:39 2021 +1000

    pixelsampler: show color preview box

commit dacd9be6971c5c0312ae45c8db349d47910a80dd
Author: itsmattkc <itsmattkc@gmail.com>
Date:   Thu May 27 12:43:32 2021 +1000

    renderer: interlace on GPU

commit 074cea06cb87e9fdc4e8ea6b09587be6df296057
Author: itsmattkc <itsmattkc@gmail.com>
Date:   Thu May 27 12:43:14 2021 +1000

    renderer: added texture clear option

commit 5d4f86b4cf1b1dcd3fb8e8c854ffa7f6fb8ca346
Author: itsmattkc <itsmattkc@gmail.com>
Date:   Thu May 27 12:42:12 2021 +1000

    renderer: updated scopes for shared textures

commit 6fad96358d189874cf45f7887b7e13cc2b1603c4
Author: itsmattkc <itsmattkc@gmail.com>
Date:   Thu May 27 11:42:05 2021 +1000

    opengl: fixed edge case

commit 1a19ffb53703ac6f30ed210f6d8eb5fc4b7b0f2d
Author: itsmattkc <itsmattkc@gmail.com>
Date:   Thu May 27 10:56:13 2021 +1000

    opengl: fix deinterlace shader

commit 085961aa39cca90ebf51b919a78ef07a4882f0e1
Author: itsmattkc <itsmattkc@gmail.com>
Date:   Thu May 27 10:08:40 2021 +1000

    opengl: downgrade to ES 2.0

    With half-float/float/3D extensions, this should be doable

commit ea1ab45cbcf5e017dfd0d8f28b231ff3255dfe92
Author: itsmattkc <itsmattkc@gmail.com>
Date:   Thu May 27 10:06:59 2021 +1000

    renderer: fixed mutex deadlock

commit ecc2f08b16f03421870c5b61625ecd26f2f96582
Author: itsmattkc <itsmattkc@gmail.com>
Date:   Wed May 26 21:28:13 2021 +1000

    opengl: fixed shared contexts

commit 261c689ea8089463155cf11b9ab15aa3f879f439
Merge: bfd4338a 91c88b1c
Author: itsmattkc <itsmattkc@gmail.com>
Date:   Wed May 26 19:52:00 2021 +1000

    Merge branch 'master' into shared-contexts

commit bfd4338aaa3b09b6fbb7717c637face8d5490721
Author: itsmattkc <itsmattkc@gmail.com>
Date:   Wed May 26 18:52:38 2021 +1000

    viewer: remove debug line

commit 45868d8a396181bf81c24b92a1ac5ce9ffed3426
Merge: 642f8e9d d0bd5e21
Author: itsmattkc <itsmattkc@gmail.com>
Date:   Wed May 26 17:21:48 2021 +1000

    Merge branch 'master' into shared-contexts

commit 642f8e9df7d7d1a9ed4202d428f4d968ff668552
Merge: 861e5b89 4de0a727
Author: itsmattkc <itsmattkc@gmail.com>
Date:   Wed May 26 17:01:38 2021 +1000

    Merge branch 'master' of https://github.com/olive-editor/olive into shared-contexts

commit 861e5b89a38c281897dc44b20e3587d39c4f808c
Merge: 472598a7 ef31c3fb
Author: itsmattkc <itsmattkc@gmail.com>
Date:   Wed May 26 14:28:21 2021 +1000

    Merge branch 'master' into shared-contexts

commit 472598a740a095aa43a4aad5680dd5abcf453a4c
Author: itsmattkc <itsmattkc@gmail.com>
Date:   Fri May 14 16:29:35 2021 +1000

    attempt at sharing contexts
2021-05-29 20:02:45 +10:00
itsmattkc 91c88b1ccf openglrenderer: initialize framebuffer variable as null 2021-05-26 18:07:18 +10:00
itsmattkc 5fb9793f43 opengl: use texture cache
Prevents a ton of texture allocation/deallocation. Should theoretically improve things, might make no noticeable difference.
2021-05-13 16:38:45 +10:00