wallstudio / RecottePlugin

MIT License
1 stars 0 forks source link

プレビュー画面の外部Window化 #4

Closed wallstudio closed 3 years ago

wallstudio commented 3 years ago

https://twitter.com/mao_akiutagames/status/1426579699333955590?s=19

DX11 APIの上書きだけでいけそう

wallstudio commented 3 years ago

image

wallstudio commented 3 years ago

DirectX11 の同期方法がよくわからない

DX12の場合

…と思ったけど、DX12で同期をかけてるのは、実行中のCommandList(CommandQueue)に新規でコマンドを積んではいけないからかな。IDXGISwapChain::Presentについては、BackBuffer->FrontBufferへの転送はCommandList(DeviceContext)が完了してから実行されるし、オフスクリーンやComputeの場合は、Map時に同期されるということだろうか。

wallstudio commented 3 years ago
  1. 本体のPresent直前で、SwapchainのBackBufferの内容を、PluginWindowのSwapchainのBackBufferにコピー
  2. 本体、PluginWindowともにSwapchainをPresent
wallstudio commented 3 years ago

image

wallstudio commented 3 years ago

技術的課題はクリア

Animation3

wallstudio commented 3 years ago

目的のRTだけピンポイントでとりたい…

    ExternalPreviewView.dll!Graphics::AddRenderTexture(
                Microsoft::WRL::ComPtr<ID3D11Resource> resource={...})
    ExternalPreviewView.dll!``OnPluginStart...
    ExternalPreviewView.dll!_Closure_wrapper_133686e3_4::<lambda_invoker_cdecl>(
                ID3D11Device* __p1=0x000001b4fbe164d0,
                ID3D11Resource* __p2=0x000001b48c0d6c70,
                const D3D11_RENDER_TARGET_VIEW_DESC* __p3=0x000000609bcfb558,
                ID3D11RenderTargetView** __p4=0x000001b48168cbc8)
    RecotteStudio.exe!00007ff7b57827f1()
>   RecotteStudio.exe!00007ff7b55fb821()
    RecotteStudio.exe!00007ff7b55fb6e4()
    RecotteStudio.exe!00007ff7b564412c()
    RecotteStudio.exe!00007ff7b56537ad()
    RecotteStudio.exe!00007ff7b558c2a2()
    RecotteStudio.exe!00007ff7b556c39c()
    RecotteStudio.exe!00007ff7b55d367c()
    ExternalPreviewView.dll!Graphics::AddRenderTexture(
                Microsoft::WRL::ComPtr<ID3D11Resource> resource={...})
    ExternalPreviewView.dll!``OnPluginStart...
    ExternalPreviewView.dll!_Closure_wrapper_133686e3_4::<lambda_invoker_cdecl>(
                ID3D11Device* __p1=0x000001b4fbe164d0,
                ID3D11Resource* __p2=0x000001b48ca6e440,
                const D3D11_RENDER_TARGET_VIEW_DESC* __p3=0x000000609bcfb558,
                ID3D11RenderTargetView** __p4=0x000001b48168bdb8)
    RecotteStudio.exe!00007ff7b57827f1()
    RecotteStudio.exe!00007ff7b55fbb4d()
    RecotteStudio.exe!00007ff7b55fb6e4()
    RecotteStudio.exe!00007ff7b564412c()
    RecotteStudio.exe!00007ff7b56537ad()
    RecotteStudio.exe!00007ff7b558c2a2()
    RecotteStudio.exe!00007ff7b556c39c()
    RecotteStudio.exe!00007ff7b55d367c()
    ExternalPreviewView.dll!Graphics::AddRenderTexture(
                Microsoft::WRL::ComPtr<ID3D11Resource> resource={...})
    ExternalPreviewView.dll!``OnPluginStart...
    ExternalPreviewView.dll!_Closure_wrapper_133686e3_4::<lambda_invoker_cdecl>(
                ID3D11Device* __p1=0x000001b4fbe164d0,
                ID3D11Resource* __p2=0x000001b484a38fa0,
                const D3D11_RENDER_TARGET_VIEW_DESC* __p3=0x000000609bcfb558,
                ID3D11RenderTargetView** __p4=0x000001b48168bea8)
    RecotteStudio.exe!00007ff7b57827f1()
    RecotteStudio.exe!00007ff7b55fbb64()
    RecotteStudio.exe!00007ff7b55fb6e4()
    RecotteStudio.exe!00007ff7b564412c()
    RecotteStudio.exe!00007ff7b56537ad()
    RecotteStudio.exe!00007ff7b558c2a2()
    RecotteStudio.exe!00007ff7b556c39c()
    RecotteStudio.exe!00007ff7b55d367c()
    ExternalPreviewView.dll!Graphics::AddRenderTexture(
                Microsoft::WRL::ComPtr<ID3D11Resource> resource={...})
    ExternalPreviewView.dll!``OnPluginStart...
    ExternalPreviewView.dll!_Closure_wrapper_133686e3_4::<lambda_invoker_cdecl>(
                ID3D11Device* __p1=0x000001b4fbe164d0,
                ID3D11Resource* __p2=0x000001b484a3a980,
                const D3D11_RENDER_TARGET_VIEW_DESC* __p3=0x000000609bcfb558,
               ID3D11RenderTargetView** __p4=0x000001b48168c538)
    RecotteStudio.exe!00007ff7b57827f1()
    RecotteStudio.exe!00007ff7b55fbd74()
    RecotteStudio.exe!00007ff7b55fb6e4()
    RecotteStudio.exe!00007ff7b564412c()
    RecotteStudio.exe!00007ff7b56537ad()
    RecotteStudio.exe!00007ff7b558c2a2()
    RecotteStudio.exe!00007ff7b556c39c()
    RecotteStudio.exe!00007ff7b55d367c()
wallstudio commented 3 years ago
# Address DPS Func _
0 ID3D11DeviceVtbl[9] ID3D11Device::CreateRenderTargetView
1 00007ff7b57827f1 160 CreateRTV TextureResource, SRV, RTVのバンドルオブジェクトを作成し、戻り値で返却
2 00007ff7b55fb821 097 CreateRTVs RTV, DSVをいくつか作成している、またD2D系の文言も、一つ目のRTVがFinalRTV、戻り値&Out引数で返却
3 00007ff7b55fb6e4 040 CreateRTVs_Wrap CreateRTVsがデータを詰める用のOut引数を初期化
4 00007ff7b564412c 274 CreatePreview PreviewView用の色々初期化、"PreviewAntialias"の文字列直後がCreateRTVs_Wrap、恐らくDX以外も含む
5 00007ff7b56537ad 480 CreateUIs 各WindowViewの初期化、"videoPreview", "ObjPropSetting", "FileExplorer", "videoTimeLine" などの文字列含む
6 00007ff7b558c2a2 181 VideoEditorSetup "EditorDialog" ~ "updateTimelineByCurrentTimeChanged" でCreateUIs、初期化→ループ?
7 00007ff7b556c39c 009 VideoEditorMain VideoEditorSetupしてShowWindowAndBlockLoop
8 00007ff7b55d367c 184 VideoEditorFeature ロード中のプログレスバー出してVEMainへ
9 00007FF7B5548854 034 SelectFeature ビデオエディタ、画面録画、ベンチマークなどで分岐
A 00007FF7B54BE636 952 WinMain

https://gist.github.com/wallstudio/5d8bf59194bd949750ec5280842ed482

wallstudio commented 3 years ago

結局は最初の一枚目を取ってこればOKだった

wallstudio commented 3 years ago

recotte_plugins_foundation.zip

wallstudio commented 3 years ago

レコスタへの要望アンケートなるものがあって1位だった

https://wikiwiki.jp/recosta/%E3%83%AC%E3%82%B3%E3%82%B9%E3%82%BF%E3%81%B8%E3%81%AE%E8%A6%81%E6%9C%9B%E3%82%A2%E3%83%B3%E3%82%B1%E3%83%BC%E3%83%88

wallstudio commented 3 years ago

タイマーベースだと、何故か字幕が出ると滅茶苦茶重くなる…

→ 本体のPresentに同期で解決

https://github.com/wallstudio/RecottePlugin/commit/c41794c5ee930168cbfa51101578e929ef6573d3#diff-045bbff7101343f9c0d8b65087a280c795b3e8890a2e78e08027d52af1a9197cR107
(コードもうちょい何とかしたみ)

wallstudio commented 3 years ago

https://github.com/wallstudio/RecottePlugin/releases/tag/v0.2.0