|
|
|
05-12-2020, 05:09 AM
|
#1161
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by amagalma
Is it good or is there a more efficient way to draw than creating and destroying bitmaps all the time?
|
In my own scripts, I overlay a large transparent canvas over the window, and then draw rectangles in it. Unfortunately, as you know, transparency doesn't yet work with macOS Metal.
|
|
|
05-12-2020, 07:28 AM
|
#1162
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Quote:
Originally Posted by juliansader
Thanks for letting me know. It seems that ReaPack regards the decimals ".01" as having the same value as ".001", so it didn't update as intended. I changed the version to ".010" and now it is available.
The 1.10 version was just a temporary upload for some people to test, and I have now deleted it.
|
Yes, the ReaPack version is not a decimal number.
Quote:
Originally Posted by juliansader
In my own scripts, I overlay a large transparent canvas over the window, and then draw rectangles in it. Unfortunately, as you know, transparency doesn't yet work with macOS Metal.
|
That was sort of my first try... I don't know if there is a big difference performance-wise, but at the time being (until the devs solve the macOS Metal issue) I'll stick to the current method.
|
|
|
05-12-2020, 11:43 AM
|
#1163
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Question: after Destroying a LICE Bitmap is InvalidateRect needed to redraw the region where the bitmap was? I tried commenting it out of my code, and the script still works and behaves as before. So, it is not needed? In which cases is it needed? (I was drawing with Composite and auto-update value set to true)
|
|
|
05-12-2020, 01:09 PM
|
#1164
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Correct, LICE_Destroy will unlink the bitmap and invalidate the region. (Unlinking ALL bitmaps from a window will also invalidate the entire window.)
|
|
|
05-12-2020, 01:19 PM
|
#1165
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,689
|
Quick question, whats the ID of TCP view? Want to draw over it (like a icon) but do not know whats tge ID or how to check any ID
|
|
|
05-12-2020, 02:53 PM
|
#1166
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Quote:
Originally Posted by Sexan
Quick question, whats the ID of TCP view? Want to draw over it (like a icon) but do not know whats tge ID or how to check any ID
|
Code:
hwnd = reaper.JS_Window_FindEx( reaper.GetMainHwnd(), nil, "REAPERTCPDisplay", "" )
No ID, no name...
|
|
|
05-12-2020, 02:53 PM
|
#1167
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
You can use reaper.JS_Window_GetLong(hwnd, "ID") to get the ID of a window.
EDIT: Strange, as amagalma noted, the TCP doesn't seem to have a usable ID.
|
|
|
05-12-2020, 09:26 PM
|
#1168
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
I am trying to implement a workaround for the compositing problems with OSX Metal, but the first step would be for the extension to reliably detect whether Metal is being used.
If anyone here uses OSX/Metal (particularly if you previously encountered problems with the compositing), I would appreciate it very much if you could test the JS_Window_EnableMetal function in the newest build from here:
https://github.com/juliansader/ReaEx...riptAPI/v1.200
What value does the function return for each of REAPER's graphics modes?
Code:
local trackview = reaper.JS_Window_FindChildByID(reaper.GetMainHwnd(), 1000)
metal = reaper.JS_Window_EnableMetal(trackview)
|
|
|
05-13-2020, 02:56 AM
|
#1169
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Shows 0, when in classic mode and also 0 when automatic (metal mode) is turned on.
|
|
|
05-13-2020, 03:28 AM
|
#1170
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Quote:
Originally Posted by juliansader
You can use reaper.JS_Window_GetLong(hwnd, "ID") to get the ID of a window.
EDIT: Strange, as amagalma noted, the TCP doesn't seem to have a usable ID.
|
This has changed in v6 for TCP. V5 had ids for it but devs made things different, cause of HiDpi IIRC. One of the reasons the devs added tons of new track-attributes to access in the Api.
|
|
|
05-13-2020, 04:55 AM
|
#1171
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Quote:
Originally Posted by juliansader
I am trying to implement a workaround for the compositing problems with OSX Metal, but the first step would be for the extension to reliably detect whether Metal is being used.
If anyone here uses OSX/Metal (particularly if you previously encountered problems with the compositing), I would appreciate it very much if you could test the JS_Window_EnableMetal function in the newest build from here:
https://github.com/juliansader/ReaEx...riptAPI/v1.200
What value does the function return for each of REAPER's graphics modes?
Code:
local trackview = reaper.JS_Window_FindChildByID(reaper.GetMainHwnd(), 1000)
metal = reaper.JS_Window_EnableMetal(trackview)
|
I made a thread about this, hope you don't mind! Trying to help
|
|
|
05-13-2020, 05:49 AM
|
#1172
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by _Stevie_
Shows 0, when in classic mode and also 0 when automatic (metal mode) is turned on.
|
Drat, seems like my Metal detector is still not working.
In automatic mode, are you sure that Metal is turned on?
* On you Mac, if you go to the Apple icon -> About this Mac -> System report -> Graphics/Displays, you should see a Metal: Supported field.
* When you ran my Multi Tool MIDI script on previous versions of the extension, you should see the entire window covered by an opaque bitmap, whereas amagalma's guideline script shouldn't show any line.
|
|
|
05-13-2020, 05:55 AM
|
#1173
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by amagalma
|
Thank you very much for trying to help! Actually I just need one or two people who can test a few updates until I get it working. (I am a bit embarassed to get too many people involved.)
Thanks to feedback by Justin himself, I know what the problem is with the disappearing guidelines, and it is easy to implement a workaround for the blitting part -- if I can only figure out why my Metal checking doesn't work as expected...
|
|
|
05-13-2020, 06:07 AM
|
#1174
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Quote:
Originally Posted by juliansader
Thank you very much for trying to help! Actually I just need one or two people who can test a few updates until I get it working. (I am a bit embarassed to get too many people involved.)
Thanks to feedback by Justin himself, I know what the problem is with the disappearing guidelines, and it is easy to implement a workaround for the blitting part -- if I can only figure out why my Metal checking doesn't work as expected...
|
Oh, ok! I saw you removed the thread.. Sorry for posting without asking! I was just trying to help!
Anyway here is a quick test script if anyone needs it:
Code:
if not reaper.GetOS():find("OSX") then
reaper.ShowConsoleMsg("Only OSX users please! Thanks!\n")
return
end
if reaper.JS_ReaScriptAPI_Version() ~= 1.2 then
reaper.ShowConsoleMsg("Install v1.2 please! Thanks!\n")
reaper.CF_ShellExecute( "https://github.com/juliansader/ReaExtensions/tree/master/js_ReaScriptAPI/v1.200" )
return
end
local trackview = reaper.JS_Window_FindChildByID(reaper.GetMainHwnd(), 1000)
local metal = reaper.JS_Window_EnableMetal(trackview)
local reaperini = reaper.GetResourcePath() .. "/REAPER.ini"
local _, setting = reaper.BR_Win32_GetPrivateProfileString( "reaper", "osxnomiddlemancocoa", "", reaperini )
if setting == "0" then
setting = "automatic (Metal)"
elseif setting == "-1" then
setting = "disabled optimized drawing"
elseif setting == "1" then
setting = "classic mode"
else
setting = "(couldnt retrieve)"
end
reaper.ShowConsoleMsg("Current setting is set to :" .. setting)
reaper.ShowConsoleMsg("\nmetal = " .. metal .. "\n")
reaper.defer(function() end)
In my VMWare OSX Catalina installation I always get 0 no matter the setting.
|
|
|
05-13-2020, 07:19 AM
|
#1175
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Quote:
Originally Posted by juliansader
Drat, seems like my Metal detector is still not working.
In automatic mode, are you sure that Metal is turned on?
* On you Mac, if you go to the Apple icon -> About this Mac -> System report -> Graphics/Displays, you should see a Metal: Supported field.
* When you ran my Multi Tool MIDI script on previous versions of the extension, you should see the entire window covered by an opaque bitmap, whereas amagalma's guideline script shouldn't show any line.
|
Tested on 2 of my machines. The MacBook does indeed not support Metal, but my iMac does:
And yes, I had the entire window covered with the iMac, when Metal was turned on.
Test results from my iMac:
Current setting is set to :automatic (Metal)
metal = 0
Current setting is set to :classic mode
metal = 0
|
|
|
05-13-2020, 03:02 PM
|
#1176
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
I've uploaded v1.204 to the same link as above. Let's see if this version works better!
|
|
|
05-13-2020, 03:06 PM
|
#1177
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Seems to totally work
Quote:
Current setting is set to :automatic (Metal)
metal = 2
|
|
|
|
05-13-2020, 03:10 PM
|
#1178
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,689
|
Interested what would the rendering difference be with Metal on A51, would like to test but no OSX, only PCMasterRace
|
|
|
05-13-2020, 03:12 PM
|
#1179
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by _Stevie_
|
Woohoo! While you are in Metal mode, could you please check if the scripts now work properly?
|
|
|
05-13-2020, 03:19 PM
|
#1180
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Quote:
Originally Posted by _Stevie_
|
This is very good news!!!
|
|
|
05-13-2020, 03:24 PM
|
#1181
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,689
|
Extremely good news!!!! Really hope there are not extreme changes regarding rendering performance because I will make sure that Reaper will be the first DAW that utilizes Vulkan and Scwha will not like that
|
|
|
05-13-2020, 03:28 PM
|
#1182
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Quote:
Originally Posted by juliansader
Woohoo! While you are in Metal mode, could you please check if the scripts now work properly?
|
Yes, of course! Checking...
Eeek, I get funny results!
Not sure what to say, almost there? LOL
|
|
|
05-13-2020, 03:45 PM
|
#1183
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by _Stevie_
Eeek, I get funny results!
Not sure what to say, almost there? LOL
|
Bummer. I wonder why it looks OK while you are drawing the area, but then goes haywire as soon as you release the mouse.
It would be very helpful if you could also try amagalma's guideline script in the arrange view, and my Multi Tool script in the MIDI editor.
This is probably another bug in Metal, since the same workaround code works perfectly in Windows and Linux and non-Metal OSX.
Last edited by juliansader; 05-13-2020 at 03:52 PM.
|
|
|
05-13-2020, 03:49 PM
|
#1184
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,689
|
The script makes 1-2 cycles more compositing (we had one issue and I pass renderining few more cycles to solve it). Maybe try with auto refresh off in Compositing call (11th argument)
|
|
|
05-13-2020, 03:50 PM
|
#1185
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Multi Script:
|
|
|
05-13-2020, 03:54 PM
|
#1186
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
And the amagalma guide:
|
|
|
05-13-2020, 03:55 PM
|
#1187
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Oops, sorry, I forgot that the Multi Script actually skips compositing if Metal is enabled.
To enable compositing, line 4658, which is currently:
Code:
if macOS and reaper.JS_Window_EnableMetal(windowUnderMouse) > 0 then
can be changed to
|
|
|
05-13-2020, 04:07 PM
|
#1188
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
@Julian: enabled the composite mode that you mentioned:
|
|
|
05-13-2020, 04:09 PM
|
#1189
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Also set the auto refresh to false in AS51:
|
|
|
05-14-2020, 03:44 AM
|
#1190
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,689
|
My brain went 404, I want to draw on the most right part of TCP but I cannot get right coordinates, it also needs to update them on resizing.
Have no problem on the left side, but cannot get client right side
Code:
local TCPhwnd = reaper.JS_Window_FindEx( reaper.GetMainHwnd(), nil, "REAPERTCPDisplay", "" )
retval, left, top, right, bottom = reaper.JS_Window_GetRect( windowHWND )
Tried this (converted to client since it gives screen) but nothing.
I need automatically detected right edge
EDIT: I got it, left and right need to be subtracted
Last edited by Sexan; 05-14-2020 at 04:06 AM.
|
|
|
05-14-2020, 03:52 AM
|
#1191
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Alas, Justin has confirmed that the "workaround" functions that I tried to use are also not yet implemented for Metal, so we are out of luck.
|
|
|
05-14-2020, 06:50 AM
|
#1192
|
Human being with feelings
Join Date: Oct 2017
Location: U.K
Posts: 542
|
Quote:
Originally Posted by juliansader
Alas, Justin has confirmed that the "workaround" functions that I tried to use are also not yet implemented for Metal, so we are out of luck.
|
Bummer, did he mention if this will get looked at? Really appreciate everyone who is trying to help improve the metal/scripting support. I will keep an eye on this thread too.
|
|
|
05-14-2020, 12:10 PM
|
#1193
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Any ideas how to get rid of the tearing?
Happens on Windows and macOS, when play is activated and my split tool is running:
Using this in the init:
Code:
local line = reaper.JS_LICE_CreateBitmap(true, 1, 1)
reaper.JS_LICE_Clear(line, 0x66FFFFFF)
And this in the defer main:
Code:
if x ~= prev_x or y ~= prev_y then
DrawArrangeLine(x, y, height, mouse_proj_pos)
end
And here's the function
Code:
function DrawArrangeLine(x, y, height, mouse_proj_pos)
if reaper.JS_Window_FromPoint(x, y) == arrange_view then
-- check for snap and return snapped x or x
local x = GetLinePos(x, mouse_proj_pos)
reaper.JS_Composite(arrange_view, x-1, 0, 3, height, line, 0, 0, 1, 1, true)
else
reaper.JS_Composite(arrange_view, 0, 0, 0, 0, line, 0, 0, 1, 1, true) -- erase line
end
end
Last edited by _Stevie_; 05-14-2020 at 12:18 PM.
|
|
|
05-14-2020, 07:05 PM
|
#1194
|
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 15,746
|
The latest +dev build should fix the issues re: Metal, I hope!
|
|
|
05-15-2020, 01:23 AM
|
#1195
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,458
|
Quote:
Originally Posted by Justin
The latest +dev build should fix the issues re: Metal, I hope!
|
This is great news! Thank you Justin!
|
|
|
05-15-2020, 08:11 AM
|
#1196
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Just tested with AS51 and Multi Tool. Not working with the latest pre build in metal mode. Same issues as before.
|
|
|
05-15-2020, 08:32 AM
|
#1197
|
Human being with feelings
Join Date: Jul 2009
Posts: 3,714
|
Quote:
Originally Posted by _Stevie_
Just tested with AS51 and Multi Tool. Not working with the latest pre build in metal mode. Same issues as before.
|
Justin has just replied that BitBlt doesn't yet work *from* Metal windows, and that is the function that I used apply in my attempted workaround in the latest version of the extension. So, ironically, the previous versions of the extension should work better.
|
|
|
05-15-2020, 08:33 AM
|
#1198
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Reverting and checking!
|
|
|
05-15-2020, 08:36 AM
|
#1199
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Okay, checked with 1.002 and AS + Multi Tool and it works in Metal mode!
However, in certain circumstances a lot of flickering is involved.
Trying to capture with LiceCap...
|
|
|
05-15-2020, 08:44 AM
|
#1200
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Okay, that worked: sidenote, if you want to capture flickering use the same fps as your monitor
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 03:26 AM.
|