Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 01-10-2020, 04:02 AM   #1
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,016
Default WDL/swell on OSX: BitBlt and StretchBlt: SRCCOPY_USEALPHACHAN not working

(Cross-posting from the WDL Users subforum, since I'm not sure if the devs regularly check that subforum.)

On my Windows 64bit, Linux 32bit and OSX High Sierra systems [EDIT: Since the bug seems to be related to Apple's Metal graphics, it can probably occur in any macOS version from El Capitan or later, and in REAPER v6.0 or later.], StretchBlt with SRCCOPY_USEALPHACHAN works fine, and transparent graphics can be drawn on top of REAPER's windows, such as:




On some users' OSX systems, however, per-pixel alpha blending doesn't seem to work, and graphics are drawn fully opaque:




* Since the script works fine on all three my systems, I don't think there is a bug in the script itself.

* The black background is created by LICE_Clear(bitmap, 0), so the order of R, G, B and A isn't relevant -- it should just be fully transparent.

Last edited by juliansader; 02-22-2020 at 03:54 AM.
juliansader is offline   Reply With Quote
Old 01-10-2020, 05:18 AM   #2
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,692
Default

Hmm SRCCOPY_USEALPHACHAN shouldn't work on win32. Or on macOS when Metal is enabled for the window in question.
Justin is offline   Reply With Quote
Old 01-10-2020, 05:38 AM   #3
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,016
Default

Oops, I should have written that on Windows, the script uses the Win32 function AlphaBlend, not the WDL/swell function StretchBlt.

I am relieved that the source of the problem was so easy to spot. Would it be possible to update REAPER's built-in BitBlt and StretchBlt to apply per-pixel alpha in Metal?
juliansader is offline   Reply With Quote
Old 01-10-2020, 06:17 AM   #4
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,692
Default

Quote:
Originally Posted by juliansader View Post
Oops, I should have written that on Windows, the script uses the Win32 function AlphaBlend, not the WDL/swell function StretchBlt.

I am relieved that the source of the problem was so easy to spot. Would it be possible to update REAPER's built-in BitBlt and StretchBlt to apply per-pixel alpha in Metal?
I’ll look to see if it is possible, it might be extremely difficult though.
Justin is offline   Reply With Quote
Old 01-16-2020, 12:55 PM   #5
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,016
Default

I really hope that it will be possible for WDL/swell blitting to work with Metal.

The ability to draw inside REAPER's windows is supposed to be one of the highlights of the ReaScriptAPI extension, and is essential for making scripts seem seamlessly integrated into REAPER' UI.

Besides my own scripts, two other examples of WIP scripts that use these functions are Sexan's Area51 script, and an as-yet unnamed script by lb0:



juliansader is offline   Reply With Quote
Old 01-16-2020, 01:02 PM   #6
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,016
Default

I should point out, however, that WDL/swell blitting is only a means to an end, namely drawing inside REAPER's windows -- and is a bit of a hack.

If REAPER could implement a native function for linking LICE bitmaps with REAPER windows *before* they are drawn in Metal, such a function might work better, with less flickering -- and might even be easier to code -- than updating swell to work with Metal.

This idea was originally discussed in the FR Extension API: Link LICE bitmap to REAPER window, for seamless integration into UI.
juliansader is offline   Reply With Quote
Old 01-29-2020, 11:52 AM   #7
o_e
Human being with feelings
 
Join Date: May 2016
Posts: 444
Default

Quote:
Originally Posted by juliansader View Post
I should point out, however, that WDL/swell blitting is only a means to an end, namely drawing inside REAPER's windows -- and is a bit of a hack.

If REAPER could implement a native function for linking LICE bitmaps with REAPER windows *before* they are drawn in Metal, such a function might work better, with less flickering -- and might even be easier to code -- than updating swell to work with Metal.

This idea was originally discussed in the FR Extension API: Link LICE bitmap to REAPER window, for seamless integration into UI.
May I ask if there any progress in this topic?
o_e is offline   Reply With Quote
Old 01-31-2020, 12:34 AM   #8
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,016
Default

Sadly, not that I am aware of.

The first mention of Metal that I could find in the changelogs, is from v6.0, so I assume that the problem arose only recently:
Quote:
v6.0 - December 3 2019
+ macOS: use Metal display output on 10.11+ for various windows
juliansader is offline   Reply With Quote
Old 02-01-2020, 05:26 AM   #9
o_e
Human being with feelings
 
Join Date: May 2016
Posts: 444
Default

Quote:
Originally Posted by juliansader View Post
Sadly, not that I am aware of.

The first mention of Metal that I could find in the changelogs, is from v6.0, so I assume that the problem arose only recently:
Just reread the whole thread, so on macOS 10.13, 'High Sierra' everything works fine? Then I would consider upgrading my OS..?
o_e is offline   Reply With Quote
Old 02-01-2020, 05:41 AM   #10
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,016
Default

I will update the first post to point out that, AFAIK, the problem isn't caused by specific versions of macOS. Instead, as another user found, it seems to be triggered by a setting in REAPER that activates Metal:

Quote:
Originally Posted by tmmmmm View Post
Same "bug" on my mac os 10.4-system. Setting "Display Updates" in the "Advanced UI/system tweaks..."-Settings to "Force Classic" fixes it for now - not sure of all downsides of that, though.
juliansader is offline   Reply With Quote
Old 02-01-2020, 10:04 AM   #11
o_e
Human being with feelings
 
Join Date: May 2016
Posts: 444
Default

Quote:
Originally Posted by juliansader View Post
I will update the first post to point out that, AFAIK, the problem isn't caused by specific versions of macOS. Instead, as another user found, it seems to be triggered by a setting in REAPER that activates Metal:
But does it work on your 'High Sierra' System? So maybe it is worth a try to upgrade the OS (as a temporarily workaround until it gets fixed in Reaper)..?

Last edited by o_e; 02-01-2020 at 10:24 AM.
o_e is offline   Reply With Quote
Old 02-01-2020, 12:46 PM   #12
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,016
Default

I'm not very knowledgeable about Apple stuff, but I think my virtual macOS test system is not powerful enough to run Metal, even if it's enabled in REAPER, so I never encountered the bug.

On your system, do you still see the bug if you disable Metal in REAPER's settings?
juliansader is offline   Reply With Quote
Old 02-12-2020, 08:11 PM   #13
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,097
Default

Yes please.... please fix this Cockos. Having this issue in OSX as well:



Thanks for all your hard work Julian!!!

And the Cockos Dev eam!!

Cheers,

Andrew K
__________________
Cheers,
Andrew K
v6.03+dev0114 - January 14 2020 • Mac 10.12.+ • i7 Quad 2.9GHz • 24GB
Thonex is offline   Reply With Quote
Old 02-22-2020, 05:30 AM   #14
todd_r
Human being with feelings
 
todd_r's Avatar
 
Join Date: Nov 2006
Posts: 637
Default

This is a pretty huge deal for the people writing the most advanced scripts, which is a big part of the attraction to reaper. Hoping we get some news soon?
todd_r is offline   Reply With Quote
Old 04-03-2020, 04:44 AM   #15
Ideosound
Human being with feelings
 
Ideosound's Avatar
 
Join Date: Oct 2017
Location: U.K
Posts: 211
Default

Hope this gets fixed soon, I want to be able to use sexan's LUA : Area(51) Selection Alpha on mac (with metal/dark mode enabled). Currently, you have to select 'force classic drawing mode' in the prefs for the script to work.

However then you can't use dark mode since using the older, classic drawing mode is not smooth enough. If this got fixed then you should be able to use the newer metal drawing mode with dark mode (which can only work using the metal mode) and people's scripts will work as intended.
Ideosound is offline   Reply With Quote
Old Today, 02:01 AM   #16
Ideosound
Human being with feelings
 
Ideosound's Avatar
 
Join Date: Oct 2017
Location: U.K
Posts: 211
Default

Quote:
Originally Posted by Justin View Post
I’ll look to see if it is possible, it might be extremely difficult though.
Pleaseeeeeeee
Ideosound is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:58 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.